blurredvision Posted August 10, 2008 Share Posted August 10, 2008 I have a list of stat leaders on my webpage, and they are ordered by either ASC or DESC. All but 1 of the rows returned are 4 digits, that lone one being 3 digits. The easiest way to explain is just to show you: example As you can see, it's putting the 3-digit return on the wrong side of the order. Why would it be doing this, and what would I need to do to fix it? Link to comment https://forums.phpfreaks.com/topic/119040-solved-why-is-my-order-by-not-ordering-correctly/ Share on other sites More sharing options...
corbin Posted August 10, 2008 Share Posted August 10, 2008 Can we see your CREATE TABLE statement (or atleast your column definition for the column you are sorting by) and your SQL query? Link to comment https://forums.phpfreaks.com/topic/119040-solved-why-is-my-order-by-not-ordering-correctly/#findComment-612987 Share on other sites More sharing options...
blurredvision Posted August 10, 2008 Author Share Posted August 10, 2008 http://img401.imageshack.us/img401/213/leadertablenx3.jpg Link to comment https://forums.phpfreaks.com/topic/119040-solved-why-is-my-order-by-not-ordering-correctly/#findComment-612992 Share on other sites More sharing options...
cooldude832 Posted August 10, 2008 Share Posted August 10, 2008 well seeing you query would be great cause we have no clue what you wrote and it is sorting right you just wrote it wrong for what you want. Link to comment https://forums.phpfreaks.com/topic/119040-solved-why-is-my-order-by-not-ordering-correctly/#findComment-612994 Share on other sites More sharing options...
blurredvision Posted August 10, 2008 Author Share Posted August 10, 2008 well seeing you query would be great cause we have no clue what you wrote and it is sorting right you just wrote it wrong for what you want. Sorry, completely forgot the query . This is the one for the total offensive stats. $leadersquery1 = "SELECT gamertag_id,total_offense FROM league_leaders WHERE season=$currentseason ORDER BY total_offense DESC LIMIT 12"; $leadersrun1 = mysqli_query($dbc, $leadersquery1); Link to comment https://forums.phpfreaks.com/topic/119040-solved-why-is-my-order-by-not-ordering-correctly/#findComment-612996 Share on other sites More sharing options...
iceblox Posted August 10, 2008 Share Posted August 10, 2008 Ive had the same problem, If im reading your post right by changing the score field to "float" this should fix it. Im not 100% sure though, couldnt hurt to try ;o) Maybe an experienced poster can confirm this? Link to comment https://forums.phpfreaks.com/topic/119040-solved-why-is-my-order-by-not-ordering-correctly/#findComment-612997 Share on other sites More sharing options...
cooldude832 Posted August 10, 2008 Share Posted August 10, 2008 not a float an integer float's are numbers but not needed for what is shown. Link to comment https://forums.phpfreaks.com/topic/119040-solved-why-is-my-order-by-not-ordering-correctly/#findComment-613000 Share on other sites More sharing options...
blurredvision Posted August 10, 2008 Author Share Posted August 10, 2008 Ive had the same problem, If im reading your post right by changing the score field to "float" this should fix it. Im not 100% sure though, couldnt hurt to try ;o) Maybe an experienced poster can confirm this? Well, this worked perfectly fine, so I think I'll go with it. Thanks iceblox! Link to comment https://forums.phpfreaks.com/topic/119040-solved-why-is-my-order-by-not-ordering-correctly/#findComment-613014 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.