Jump to content

ORDER BY


Cooper94

Recommended Posts

<?php 
$result = mysql_query("SELECT * FROM pilots ORDER BY hours LIMIT 5");
while ($row = mysql_fetch_array($result))
{
echo "<tr bgcolor=#F1F1F1>";
echo "<td width=195 class=td1b>{$row['name']}</td>";
echo "<td width=95 class=td1>{$row['hours']} Hours</td>";
echo "</tr>";
}
?>

When it shows up it is complety random, I mean it dosnt show the person with the most hours it shows them all randomized. Hours go by the tenth such as 10.2,11.5, ect is there something I have to do to make the system be able to read the tenthspot?

 

Thank You

Link to comment
https://forums.phpfreaks.com/topic/147553-order-by/
Share on other sites

I am afraid not here is the code:

<?php 
$result = mysql_query("SELECT * FROM pilots WHERE hours>'1' ORDER BY hours ASC LIMIT 5");
while ($row = mysql_fetch_array($result))
{
echo "<tr bgcolor=#ffffff>";
echo "<td width=195 class=td1b>{$row['name']}</td>";
echo "<td width=95 class=td1>{$row['hours']} Hours</td>";
echo "</tr>";
}
?>

It is still random :(

 

Thank You

Link to comment
https://forums.phpfreaks.com/topic/147553-order-by/#findComment-774574
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.