SUNIL16 Posted September 16, 2008 Share Posted September 16, 2008 Hi friends, I created an forum in my website and i done paging also, the problem is i given auto increment while creating table in database below is the code i used mysql_query("CREATE TABLE `forum_question` ( `id` int(4) NOT NULL auto_increment, `topic` varchar(255) NOT NULL default'0', `detail` longtext NOT NULL, `name` varchar(65) NOT NULL default '0', `datetime` varchar(25) NOT NULL default'0', `view` int(4) NOT NULL default '0', `reply` int(4) NOT NULL default '0', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=1 "); Now the problem is the first 10 result i am getting is not the latest messages.These are very first messages. so i want to display the latest message in the first retrieval page. how can i do that? Link to comment https://forums.phpfreaks.com/topic/124449-needed-help/ Share on other sites More sharing options...
Garethp Posted September 16, 2008 Share Posted September 16, 2008 $Query1 = mysql_query("SELECT * FROM messages"); $Upper = mysql_num_rows(query); $Lower = $Upper - 10; $Show = mysql_query("SELECT * FROM messages LIMIT '$Lower', '$Upper'"); Link to comment https://forums.phpfreaks.com/topic/124449-needed-help/#findComment-642664 Share on other sites More sharing options...
ratcateme Posted September 16, 2008 Share Posted September 16, 2008 add ORDER DESC to the end of your query Scott. Link to comment https://forums.phpfreaks.com/topic/124449-needed-help/#findComment-642665 Share on other sites More sharing options...
SUNIL16 Posted September 16, 2008 Author Share Posted September 16, 2008 Thanks Garethp Link to comment https://forums.phpfreaks.com/topic/124449-needed-help/#findComment-642939 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.