mike1313 Posted November 26, 2007 Share Posted November 26, 2007 How would I properly use ORDER By in this statement? $sql = "SELECT message_id, user_name, message, date_format(post_time, '%h:%i') as post_time" . " FROM message WHERE cn_id = " . db_input($_GET['cn']) . " AND message_id > " . $last; Quote Link to comment Share on other sites More sharing options...
xyn Posted November 26, 2007 Share Posted November 26, 2007 Can you explain more about your "order" try explaining it a bit more of what you are trying to do. Quote Link to comment Share on other sites More sharing options...
mike1313 Posted November 26, 2007 Author Share Posted November 26, 2007 I want to display the last 20 rows and ORDER BY message_id how would I do this? Quote Link to comment Share on other sites More sharing options...
xyn Posted November 26, 2007 Share Posted November 26, 2007 mysql_query("select * from `table` ORDER BY `message_id` DESC Limit 0,20") Quote Link to comment Share on other sites More sharing options...
mike1313 Posted November 26, 2007 Author Share Posted November 26, 2007 I know that much but I want to change as little as possible in my current statement. Quote Link to comment Share on other sites More sharing options...
xyn Posted November 26, 2007 Share Posted November 26, 2007 ORDER BY `message_id` DESC Limit 0,20 use that at the end of your query then... 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.