AbydosGater Posted October 7, 2006 Share Posted October 7, 2006 Hi, Sorry for the topic name!, bit confusing... ButHeres my script...[code] $query = "SELECT * FROM ben_news ORDER BY id"; $result = mysql_query($query); while($news = mysql_fetch_array($result)) {$member_id = $news['member_id'];$author = "SELECT username FROM ben_users WHERE member_id='$member_id'"; $authorresult = mysql_query($author); $authorinfo = mysql_fetch_array( $authorresult );echo "<table width='455' border='0' cellspacing='0' cellpadding='0' background='image/longmenu.gif' height='34'> <tr> <td><FONT FACE='Tahoma'><b>" . $news['title'] . "</b></FONT></td> </tr> </table> ";echo "<p>";echo $news['content'];echo "</p>";echo "<p>"; echo "<hr><br>"; echo "Author: " . $authorinfo['username'] . " " . "Date/Time: " . $news['timedate'];echo "</p>";};};[/code]Right no need to read all of that, but the Important bit is $query = "SELECT * FROM ben_news ORDER BY id";The id field is an Auto Int.. And it all works fine! but i was wondering how do i get it to order backwards? start with the highest number, 5,4,3,2,1... and so on???ThanksAbydos Link to comment https://forums.phpfreaks.com/topic/23283-sql-pulling-in-order-how-out-of-order-p/ Share on other sites More sharing options...
redarrow Posted October 7, 2006 Share Posted October 7, 2006 DESCorASC Link to comment https://forums.phpfreaks.com/topic/23283-sql-pulling-in-order-how-out-of-order-p/#findComment-105547 Share on other sites More sharing options...
AbydosGater Posted October 7, 2006 Author Share Posted October 7, 2006 Ok, Thanks, but where does that go? Link to comment https://forums.phpfreaks.com/topic/23283-sql-pulling-in-order-how-out-of-order-p/#findComment-105549 Share on other sites More sharing options...
redarrow Posted October 7, 2006 Share Posted October 7, 2006 $query = "SELECT * FROM ben_news ORDER BY id ASC";or$query = "SELECT * FROM ben_news ORDER BY id DESC";This link is for you ok.http://www.1keydata.com/sql/sql-syntax.html Link to comment https://forums.phpfreaks.com/topic/23283-sql-pulling-in-order-how-out-of-order-p/#findComment-105552 Share on other sites More sharing options...
AbydosGater Posted October 7, 2006 Author Share Posted October 7, 2006 Have It, Thanks very much, fast reply! Link to comment https://forums.phpfreaks.com/topic/23283-sql-pulling-in-order-how-out-of-order-p/#findComment-105554 Share on other sites More sharing options...
redarrow Posted October 7, 2006 Share Posted October 7, 2006 good luck but use the link i provided for mysql as it the best ever mysql website for learning i have ever seen. Link to comment https://forums.phpfreaks.com/topic/23283-sql-pulling-in-order-how-out-of-order-p/#findComment-105556 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.