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..
Sorry for not explaining well, but I hope you guys can understand..
$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?