<form action="book_dive.php" method="post">
<input type="submit" value="Submit">
<table border="1" width="75%" cellpadding="2" cellspacing="2">
<tr>
<td align="center">BOOK</td>
<td align="center">DATE</td>
<td align="center">TIME</td>
<td align="center">LEAVING FROM</td>
<td align="center">BOAT</td>
<td align="center">DEPTH</td>
<td align="center">DIVE SITE</td>
<td align="center">MIN QUAL</td>
</tr>
<?
include("conn.php");
$res=mysql_query("SELECT * FROM dives");
if(mysql_num_rows($res)==0) echo "No data in table";
for($i=0;$i<mysql_num_rows($res);$i++) {
$row=mysql_fetch_assoc($res); //mysql_fetch_assoc STORES A ROW IN A ARRAY AND MOVES ON TO THE NEXT ROW Each subsequent call to mysql_fetch_assoc() returns the next row in the recordset.
?>
<tr>
<td align="center"><input type="checkbox" value=<?=$row[id]?>/></td>
<td align="center"><?=$row[date]?></td>
<td align="center"><?=$row[time]?></td>
<td align="center"><?=$row[leaving_from]?></td>
<td align="center"><?=$row[boat]?></td>
<td align="center"><?=$row[depth]?></td>
<td align="center"><?=$row[dive_site]?></td>
<td align="center"><?=$row[min_qual]?></td>
</tr>
<?
}
Hi I am using this code to display a mysql database of dates etc on my web page. The problem with it is the dates in the database are in a random order but it would be better if they would be displayed on the webpage in date order. It would cause too many complications to change the order in the database. Is there an easy way to do this please?