Jump to content

[SOLVED] Why is my ORDER BY not ordering correctly?


blurredvision

Recommended Posts

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?

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);

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!

Archived

This topic is now archived and is closed to further replies.

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