Results 1 to 2 of 2
Thread: Select each row ordering by name
Jan 28, 2005, 23:27 #1
- Join Date
- Jan 2004
- 0 Post(s)
- 0 Thread(s)
Select each row ordering by name
I have a table, with an ID row, some rows that I want to get information from(match1, match2, match3, etc. are their names..up to match30, although all these rows are basically pointless in this question), and also a lastname row..
Now all I want to be able to do is go through the rows in order by last name..this means like a SELECT * FROM query where I can get each result individually..I'll try to give an example of this..
$sql = mysql_query("SELECT * FROM information WHERE grade='9' ORDER BY lastname asc");
$numrows = mysql_num_rows($sql);
for ($i=0; $i <= $numrows; $i++)
while ($row = mysql_fetch_array($sql))
// Ok, now would this code run through like 100 times if there were 100 rows from grade='9' ?
// If so, then would the first row select the last name Aardvark first, etc in alphabetical order?