schloob Posted February 7, 2009 Share Posted February 7, 2009 I am using mysql database entries to store my chat and my announcements. Each one has an incremented id. When I use mysql_fetch_assoc to list all of the records it lists them from oldest to newest. I know that I can store them in an array and then work backwards from the newest but I was wondering if there was a way to just reverse the order of mysql_fetch_assoc. Thanks. Quote Link to comment Share on other sites More sharing options...
Haunted Dawg Posted February 7, 2009 Share Posted February 7, 2009 Re: mysql_fetch_assoc in reverse order? $sel = mysql_query("SELECT rows FROM `table` ORDER BY `increment_id` ASC"); And if you want to limit the list: $sel = mysql_query("SELECT rows FROM `table` ORDER BY `increment_id` ASC LIMIT limitnumber"); Then you just call it out. while($soc = mysql_fetch_assoc($sel)) Quote Link to comment Share on other sites More sharing options...
POG1 Posted February 7, 2009 Share Posted February 7, 2009 Re: mysql_fetch_assoc in reverse order? won't u just need to order the mysql query? ORDER BY `id` DESC Quote Link to comment 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.