Cooper94 Posted March 2, 2009 Share Posted March 2, 2009 <?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 Quote Link to comment Share on other sites More sharing options...
RussellReal Posted March 2, 2009 Share Posted March 2, 2009 is hours text? if so it goes by asc value Quote Link to comment Share on other sites More sharing options...
MadTechie Posted March 2, 2009 Share Posted March 2, 2009 I agree, change the hours field to a float should solved the problem Quote Link to comment Share on other sites More sharing options...
Cooper94 Posted March 2, 2009 Author Share Posted March 2, 2009 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 Quote Link to comment Share on other sites More sharing options...
RussellReal Posted March 2, 2009 Share Posted March 2, 2009 we mean in the table structure change the field type to float try this mysql_query("ALTER TABLE `pilots` CHANGE `hours` `hours` FLOAT"); Quote Link to comment Share on other sites More sharing options...
Cooper94 Posted March 2, 2009 Author Share Posted March 2, 2009 Thank You so much! Quote Link to comment Share on other sites More sharing options...
RussellReal Posted March 2, 2009 Share Posted March 2, 2009 anytime, I'd appreciate it if you clicked 'solved' in the post options Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.