Jump to content

Wrong results when using Order By


dmccabe

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.