dmccabe Posted January 18, 2010 Share Posted January 18, 2010 Can anyone tell me why regardless of which way I order the info retreived the database the "Scanner" always comes out on top? <?php $sql = "SELECT ASSET_TYPE_ID, ASSET_TYPE_NAME FROM tblassettype ORDER BY ASSET_TYPE_NAME ASC"; $result=mysql_query($sql); while ($row=mysql_fetch_array($result)) { $id=$row["ASSET_TYPE_ID"]; $name=$row["ASSET_TYPE_NAME"]; echo "<option VALUE=\"$id\">".$name."</OPTION>"; } ?> Contents of table: 1 Monitor 2 Laptop 3 PC 4 Printer 5 Switch 6 Router 7 Scanner 8 Server 9 KVM 10 Tape Drive Yet regardless of if the table is sorted ASC or DESC, the item 7 Scanner is either very top or very bottom of list? Link to comment https://forums.phpfreaks.com/topic/188900-wrong-results-when-using-order-by/ Share on other sites More sharing options...
Buddski Posted January 18, 2010 Share Posted January 18, 2010 Do you have any other characters in front of it (ie a space)? Link to comment https://forums.phpfreaks.com/topic/188900-wrong-results-when-using-order-by/#findComment-997345 Share on other sites More sharing options...
dmccabe Posted January 18, 2010 Author Share Posted January 18, 2010 D'oh thanks Link to comment https://forums.phpfreaks.com/topic/188900-wrong-results-when-using-order-by/#findComment-997346 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.