Another Mysql Question

liunx

Guest
Im slowly working through this and I have another question. I am wondering about how to create paging? Like how display say 12 items on a page and then move to the next 12, ect...<br /><br />I have this query set up to display to a limit of 400 so I imagine I will have to make the limit a variable?<br /><br />Here's the query I have now...<br /><br />$result = mysql_query("SELECT media_info.media_id, media_type, thumbnail, description, posted, views, media_info.name, file, path, count(comments) as no_of_comments FROM media_info LEFT JOIN comments ON comments.media_id = media_info.media_id GROUP BY media_info.media_id, media_type, thumbnail, description Order by media_id DESC LIMIT 0, 400;")<br />or die(mysql_error());<br /><br />Can someone give me some tips on how to start and what is involved?<br /><br />Thanks, any help is appreciated.<!--content-->
Check out <a href="http://www.sitepoint.com/article/php-paging-result-sets" target="_blank">this article</a> at SitePoint. It teaches the theory, and develops a PHP Class that does the job nicely. I've used it effectively several times.<br /><br />Good luck.<!--content-->
<!--quoteo(post=168315:date=Mar 4 2006, 06:25 PM:name=btrfld)--><div class='quotetop'>QUOTE(btrfld @ Mar 4 2006, 06:25 PM) <a href="http://www.totalchoicehosting.com/forums/index.php?act=findpost&pid=168315"><img src='http://www.totalchoicehosting.com/forums/style_images/1/post_snapback.gif' alt='*' border='0' /></a></div><div class='quotemain'><!--quotec-->Check out <a href="http://www.sitepoint.com/article/php-paging-result-sets" target="_blank">this article</a> at SitePoint. It teaches the theory, and develops a PHP Class that does the job nicely. I've used it effectively several times.<br /><br />Good luck.<!--QuoteEnd--></div><!--QuoteEEnd--><br /><br /><br />Thanks Jim<!--content-->
 
Back
Top