schloob Posted February 7, 2009 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
Haunted Dawg Posted February 7, 2009 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
POG1 Posted February 7, 2009 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
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.