jason97673 Posted February 5, 2008 Share Posted February 5, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/89516-solved-seems-to-sort-wrong/ Share on other sites More sharing options...
GingerRobot Posted February 5, 2008 Share Posted February 5, 2008 Erm, if its ordering like 1200, 340, 8, then its just ordering DESC. You need it to order ASC. Quote Link to comment https://forums.phpfreaks.com/topic/89516-solved-seems-to-sort-wrong/#findComment-458510 Share on other sites More sharing options...
farkewie Posted February 5, 2008 Share Posted February 5, 2008 I had a look can you post your code for that query and what are the cols setup as in mysql? eg varchar or text? Quote Link to comment https://forums.phpfreaks.com/topic/89516-solved-seems-to-sort-wrong/#findComment-458512 Share on other sites More sharing options...
jason97673 Posted February 5, 2008 Author Share Posted February 5, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/89516-solved-seems-to-sort-wrong/#findComment-458516 Share on other sites More sharing options...
pdkv2 Posted February 5, 2008 Share Posted February 5, 2008 i guess you need to check with sql query, for using "order by ASC/DESC" Cheers ! Quote Link to comment https://forums.phpfreaks.com/topic/89516-solved-seems-to-sort-wrong/#findComment-458522 Share on other sites More sharing options...
GingerRobot Posted February 5, 2008 Share Posted February 5, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/89516-solved-seems-to-sort-wrong/#findComment-458524 Share on other sites More sharing options...
jason97673 Posted February 5, 2008 Author Share Posted February 5, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/89516-solved-seems-to-sort-wrong/#findComment-458530 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.