is there a way to automatically sort my table by date
at the moment all the data is pulled out with the correct username, but i want to add in there to put it into the tables according to date, either ascending or descending, doesn't bother me... can i do this, or do i have to chuck everything into arrays and then sort them out?

PHP Code:

<?php
$db 
mysql_connect("localhost","root","ascs2004");             //connect to mysql
mysql_select_db("t1",$db);                                      //connect to db
$sql "SELECT * from timesheet";                               //connect to table
$result mysql_query($sql$db) or die ("Invalid query");      //query db and catch error
echo "Previous entries for $user";                              //echo username

while ($row mysql_fetch_array($result)){                      //loop through table
if ( "$row[UserID]== "$user"){                                //match usernames
//tabulate data from table
$date1 $row['Date'];
list(
$y$m$d) = explode("-"$date1);                         //split date up
$date "$d-$m-$y";

echo 
"<tr><td>$date</td><td>";
echo 
"".$row['Duties']."</td><td>";
echo 
"".$row['Start']."</td><td>";
echo 
"".$row['Break']."</td><td>";
echo 
"".$row['Finish']."</td><td>";
echo 
"".$row['TOTAL']."</td><td>";

//post values
echo "<form method =\"POST\" action=\"".$_SERVER['PHP_SELF']."\">";
echo 
"<input type=\"hidden\" name=\"userid\" value=\"".$row['UserID']."\">";
echo 
"<input type=\"hidden\" name=\"date\" value=\"".$row['Date']."\">";
echo 
"<input type=\"hidden\" name=\"action2\" value=\"submitted\">";
echo 
"<input type=\"submit\" name=\"submit2\" value=\"Delete\">";
echo 
"</form></tr>";
        }
}
thanks

----
nick
----

i feel so stupid sometimes i really do, sorry to waste another post.

i used

PHP Code:
$sql "SELECT * FROM timesheet ORDER BY 'DATE' ASC LIMIT 0, 30"