View Full Version : Showing table rows?
01-11-2004, 10:22 PM
Heres the deal. I want to show a list of all the rows in a table. Also I want them to be sorted either by their status, id, the fullname, or the date. All values such as the status, id, fullname, and date are located in a field in each row. When the user clicks the link they are shown the data in the table according to the ID. What would the code be to creat the full list.
Also is there anyway I could have these in categories (staus) as well? So they can only see the pending ones, hired, not hired, or the trash?
01-11-2004, 10:48 PM
Dawson, this really is basic. That doesn't mean I won't help you, but simple scripts like this you should be able to find on your own. Try looking in the php manual (www.php.net/manual/en/) before posting questions. You may also want to buy a php book, that will teach you how to do stuff like this.
Rather than type this out, here's a link to a script that does a complete table dump:
just do standard queries, using ORDER BY to do the sort. ie:
"SELECT * FROM tbl_whatever ORDER BY 'status'"
01-11-2004, 10:53 PM
the answer to your second question looks like you need to look at how to use SQL.
I like: W3 Schools (http://www.w3schools.com/)
Check: Their SQL Tutorial (http://www.w3schools.com/sql/default.asp) and Their PHP Tutorial (http://www.w3schools.com/php/default.asp)
assume the database is ok, and the user clicked a link
that looked like: <a href="http://www.url.com/index.php?status=hired">Hired results</a>
$status = $_GET["status"];
$sql = "SELECT * FROM tbl_whatever WHERE status = '$status'";
01-11-2004, 10:55 PM
Sorry for posting "Simple Questions" but once again. I'm new, I don't know everything. Also I tried searching but couldn't find anything on this. Google, these forums, other forums. I probably was searching with the wrong words. Anyway, let's see if this works.
01-12-2004, 03:17 AM
are both good tutorials for learning SQL. You get to practice against a live database.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.