Hi, I'm using the following code to read data from a table, all is well but I have no idea on how to sort the input? I thought of loading it all into an array and then sorting but I have no idea on how to do this, any help would be greatly appriciated.
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb1",$db);
$result = mysql_query("SELECT * FROM table1",$db);
printf("<table><tr><td>Name:</td><td>Score:</td></tr>\n");
if ($myrow = mysql_fetch_array($result)) {
do {
printf("<tr><td>%s</td><td>%d</td></tr>\n", $myrow["name"], $myrow["score"]);
} while ($myrow = mysql_fetch_array($result));
} else {
echo "Sorry, no records were found!";
}
printf("</table>");
?>