Jump to content

[SOLVED] Seems to sort wrong.


jason97673

Recommended Posts

Im working on a project now and I ran into some sort of sorting problem. Seems like it might be

common and seems like it should be easy to fix.

 

I have my set of data which consist of mainly numbers however when clicking on the header links to sort the data it wants to sort everything using the first number. For example if you have 1200, 8, 340, it will show up in the order of 1200, 340, 8 cause it is only looking at the first numbers( 1xxx, 3xx, 8 ). Would this be something in the database or PHP? I have this at

http://5star-technologies.com/1st_downs2.php?column_name=completions so you can see for yourself.

 

In my queries, I simply have order by column name.

 

I havent run into this problem so I wouldnt know what part of the code to show, but Im guessing its a common problem.

 

Thanks for any help.

Link to comment
Share on other sites

Erm, if its ordering like 1200, 340, 8, then its just ordering DESC. You need it to order ASC.

 

Ok actually those numbers I gave were probably a bad example. A better one would be something 1200, 500, 2200. It would show 1200, 2200, then 500.

 

But I think I fixed it. It had something to do with the limit I believe.

Link to comment
Share on other sites

Fair enough - i couldn't view the site to check, since im at school and we have very annoying filters.

 

Not entirely sure how a limit would be affecting the sorting.

 

I got most of the script from a tutorial online and was messing with it, and I just deleted a line in the code and seemed to work. I think I had the line of code duplicated and it messed it up somehow.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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