Padgoi Posted February 20, 2008 Share Posted February 20, 2008 Right now, it's showing like this: How do I order it properly where it's in numerical order rather than ordering by 1's and then 2's and so on? The code I have right now is: <? $result = mysql_query("select * from Ratings order by profile"); //grab all the content while($r=mysql_fetch_array($result)) { $title=$r["username"]; $message=$r["profile"]; $date=$r["registration"]; echo "<tr><td class=\"ratingpage\">$title<td class=\"ratingpage\">$message<td class=\"ratingpage\">$date</td></td><td> <br></tr> "; } ?> Quote Link to comment Share on other sites More sharing options...
Barand Posted February 21, 2008 Share Posted February 21, 2008 Any chance you did the sensible thing and held the number to sort by in a separate column somewhere? Quote Link to comment Share on other sites More sharing options...
Padgoi Posted February 21, 2008 Author Share Posted February 21, 2008 Nope, sorry, I'm fairly new at PHP. Quote Link to comment Share on other sites More sharing options...
neylitalo Posted February 21, 2008 Share Posted February 21, 2008 You should probably redesign it so you only have the user ID in the database table, not the whole URL. MySQL sorts it that way because it's sorting strings, but if you only store numbers, it can do numerical sorting. Quote Link to comment Share on other sites More sharing options...
Barand Posted February 21, 2008 Share Posted February 21, 2008 When the user clicks on one of those links and you have u=72409, you probably search for a record somewhere with a key of 72409. Does that record contain the username, so you can link it to the Ratings table? 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.