View Full Version : Database table out of order.

10-11-2004, 07:11 PM
while ($i < $num) {

<tr bgcolor=<? echo ($i%2) ? "$color1" : "$color2" ;?>>
<td width="15"><div align=center><input type=radio name="<? echo "$temp" ?>" value="<? echo "$temp" ?>"></div></td>
<td bgcolor=<? echo ($i%2) ? "$color3" : "$color4" ;?> width="1"><font color="<? $colorID ?>"><? echo "$bold$Id$boldoff"; ?></font></td>
<td width="100"><? echo "| $Type"; ?></td>
<td width="100"><? echo "| $Size"; ?></td>
<td width="100"><? echo "| $Color"; ?></td>
<td width="150"><? echo "| $fname"; ?></td>
<td width="200"><? echo "| $lname"; ?></td>
<td width="300"><? echo "| $email"; ?></td>
<td width="150"><? echo "| $phone"; ?></td>
<td width="400"><? echo "| $street"; ?></td>
<td width="150"><? echo "| $city"; ?></td>
<td width="100"><? echo "| $state"; ?></td>
<td width="75"><? echo "| $zip"; ?></td>
<td width="300"><? echo "| $special"; ?></td>
<td width="200"><? echo "| $datetime"; ?></td>
<td width="100"><? echo "| $filled"; ?></td>

How can i get this to write the table in order of $Id, from largest to greatest? Right now it writes $Id 17, then 15 down to 11, then 18 up to 24. Its realy screwy.

10-11-2004, 07:37 PM
$query="SELECT * FROM Orders ORDER BY Id DESC";

Thats how to fix it for those who brought this up on search.

Found it by way of help from a friend.

10-12-2004, 05:24 AM
you may also wish to use mysql_fetch_assoc for legibility purposes.