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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.