stublackett Posted August 15, 2008 Share Posted August 15, 2008 Hi, I've got a DB Table which has a "Month" column What I'm looking to do is order it by Month DESC I'm achieving this, But the numbers that are coming through are ordered like this : 9 9 8 8 7 7 11 Yet when I order the eventid DESC it orders it properly, Any ideas how I can sort this out? So that its ordered by month Table layout is as follows..... id title location hour minutes day month Quote Link to comment Share on other sites More sharing options...
adam84 Posted August 15, 2008 Share Posted August 15, 2008 SELECT * From db_table ORDER BY month desc Quote Link to comment Share on other sites More sharing options...
stublackett Posted August 15, 2008 Author Share Posted August 15, 2008 SELECT * From db_table ORDER BY month desc I've done that..... Those months are not being ordered properly ??? My code is : <?php $result = mysql_query("SELECT * FROM $db_table ORDER BY month DESC LIMIT 5 "); ?> Quote Link to comment Share on other sites More sharing options...
akitchin Posted August 15, 2008 Share Posted August 15, 2008 what type of field is month? that's likely what is messing up the ORDER BY clause. Quote Link to comment Share on other sites More sharing options...
stublackett Posted August 15, 2008 Author Share Posted August 15, 2008 what type of field is month? that's likely what is messing up the ORDER BY clause. That was it, Cheers akitchin for some stupid reason I set the month field to VARCHAR, now changed to INT and its gone straight through.... Cheers *SOLVED* 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.