Drezard Posted April 5, 2007 Share Posted April 5, 2007 Hello, Im writing a small message board and im using the Time() function to get the timestamp and then im storing it in the database with the message. Now, i want to retrieve the latest messages (the latest ones inputted)... So basically my query is something like: SELECT message FROM message_board WHERE time= but thats as far as ive gotten. Can someone help me finish this query? - Cheers, Daniel Link to comment https://forums.phpfreaks.com/topic/45716-asc-and-desc/ Share on other sites More sharing options...
Rizla Posted April 5, 2007 Share Posted April 5, 2007 $query = "SELECT * FROM message_board ORDER BY id DESC"; $result = mysql_query($query)or die(mysql_error()); then use a while loop to print all your data Link to comment https://forums.phpfreaks.com/topic/45716-asc-and-desc/#findComment-222075 Share on other sites More sharing options...
opels Posted April 5, 2007 Share Posted April 5, 2007 or modifiy it slightly to retrieve the last 10 messages, $query = "SELECT * FROM message_board ORDER BY id DESC LIMIT 10"; Link to comment https://forums.phpfreaks.com/topic/45716-asc-and-desc/#findComment-222083 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.