PDA

Click to See Complete Forum and Search --> : array + mysql question


Tommy101
Sep 26th, 2005, 03:17 PM
I have made a script that gets information from a mysql table and shows it in a html table. However i would like to have the html show the information from the bottom up. (because when i add a row in my mysql table it ends up at the bottom).

Is there any way one could use the SORT_DESC function?

My code looks like this at the moment:
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "\t<tr>\n";
foreach ($line as $col_value) {
echo "\t\t<td>$col_value</td>\n";
}

lintz
Sep 26th, 2005, 07:26 PM
If you have an ID field in your table you could sort by that so the newest records are always at the top. HTH :)


$SQL = "SELECT * FROM YourTable ORDER BY ID DESC";