iNoob Posted July 20, 2011 Share Posted July 20, 2011 Hello guys. So I have a pagination that displays games from different categories. For example if I click the 'Skills Games' link, it will display only skill games from my database in the pagination results. However I have noticed that the newer games I add to my database, don't show up first in the list in the pagination results. So I added the fldDate column in my database to add the date the game was added to the database and fetch the date from the new skill games I added to the database by ascending or descending the fldDate column in the pagination results. I am trying to figure out how to fetch the current date of the new games I added and display them first in the pagination once the user clicks on 'Skills Games' link. I have a pagination script that I need to Ascend or Descent depending on the date. This is what I have as query $query = "select distinct fldCategory from games order by fldCategory"; I was thinking maybe to fetch the date by doing this: $query = "select distinct fldCategory from games order by fldCategory ORDER BY fldDate desc"; Would this be correct? Link to comment https://forums.phpfreaks.com/topic/242444-ascending-or-descending-date-in-pagination/ Share on other sites More sharing options...
AyKay47 Posted July 20, 2011 Share Posted July 20, 2011 $query = "select distinct fldCategory from games ORDER BY fldCategory DESC, ORDER BY fldDate DESC"; Link to comment https://forums.phpfreaks.com/topic/242444-ascending-or-descending-date-in-pagination/#findComment-1245195 Share on other sites More sharing options...
TeNDoLLA Posted July 20, 2011 Share Posted July 20, 2011 Should be $query = "SELECT DISTINCT fldCategory FROM games ORDER BY fldCategory DESC, fldDate DESC"; Link to comment https://forums.phpfreaks.com/topic/242444-ascending-or-descending-date-in-pagination/#findComment-1245280 Share on other sites More sharing options...
iNoob Posted July 20, 2011 Author Share Posted July 20, 2011 Thank you both! It works Link to comment https://forums.phpfreaks.com/topic/242444-ascending-or-descending-date-in-pagination/#findComment-1245296 Share on other sites More sharing options...
AyKay47 Posted July 20, 2011 Share Posted July 20, 2011 Should be $query = "SELECT DISTINCT fldCategory FROM games ORDER BY fldCategory DESC, fldDate DESC"; there goes another echo Link to comment https://forums.phpfreaks.com/topic/242444-ascending-or-descending-date-in-pagination/#findComment-1245298 Share on other sites More sharing options...
TeNDoLLA Posted July 20, 2011 Share Posted July 20, 2011 It's not echo, the line you posted does not work atleast in my dev environment(?) You have twice there ORDER BY in the clause. Did you try it out? Link to comment https://forums.phpfreaks.com/topic/242444-ascending-or-descending-date-in-pagination/#findComment-1245337 Share on other sites More sharing options...
AyKay47 Posted July 20, 2011 Share Posted July 20, 2011 It's not echo, the line you posted does not work atleast in my dev environment(?) You have twice there ORDER BY in the clause. Did you try it out? yeah you're right it was a typo, I meant to write what you did.. im sorry :'( Link to comment https://forums.phpfreaks.com/topic/242444-ascending-or-descending-date-in-pagination/#findComment-1245353 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.