adamjones Posted October 31, 2008 Share Posted October 31, 2008 Hi. So, I have this code; <?php $DB_Query = @mysql_query("SELECT * FROM `news` WHERE 1 ORDER BY `ID` DESC") OR die('MySQL error: '.mysql_error()); ?> But I want it to only echo the last 2 entries. How can I achieve this? Adam. Quote Link to comment Share on other sites More sharing options...
bobbinsbro Posted October 31, 2008 Share Posted October 31, 2008 last 2 by date, or last 2 by id? Quote Link to comment Share on other sites More sharing options...
adamjones Posted October 31, 2008 Author Share Posted October 31, 2008 Date Quote Link to comment Share on other sites More sharing options...
adamjones Posted October 31, 2008 Author Share Posted October 31, 2008 ..anyone? Quote Link to comment Share on other sites More sharing options...
revraz Posted October 31, 2008 Share Posted October 31, 2008 You want to order by date and do a limit 2 Quote Link to comment Share on other sites More sharing options...
adamjones Posted October 31, 2008 Author Share Posted October 31, 2008 How do I do that? Quote Link to comment Share on other sites More sharing options...
bobbinsbro Posted October 31, 2008 Share Posted October 31, 2008 "SELECT * FROM `news` ORDER BY date DESC LIMIT 2" i think Quote Link to comment Share on other sites More sharing options...
adamjones Posted October 31, 2008 Author Share Posted October 31, 2008 thanks, all working 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.