Orionsbelter Posted November 5, 2009 Share Posted November 5, 2009 Hi there, i am currently wanting to make a shop for myself and need to know how i can make the code, so that my page shows 20 products per page, or a choosen amount such as 20, 40, 60 etc, then have pages 1,2,3 etc depending on the amount of products. so for example i am viewing 20 products, so the page shows the first 20 products i click page 2 i shows the next 20, how can i do this thank you Link to comment https://forums.phpfreaks.com/topic/180479-help-with-products-of-pages-products-per-page-etc/ Share on other sites More sharing options...
clay1 Posted November 6, 2009 Share Posted November 6, 2009 $numofproductsperpage = 20; $i = 1; while ( $i < $numproductsperpage) { show product $i++; } Link to comment https://forums.phpfreaks.com/topic/180479-help-with-products-of-pages-products-per-page-etc/#findComment-952212 Share on other sites More sharing options...
JJ2K Posted November 6, 2009 Share Posted November 6, 2009 $numofproductsperpage = 20; $i = 1; while ( $i < $numproductsperpage) { show product $i++; } Just out of curiousity is there any reason why you use a while loop instead of a for loop? Link to comment https://forums.phpfreaks.com/topic/180479-help-with-products-of-pages-products-per-page-etc/#findComment-952216 Share on other sites More sharing options...
clay1 Posted November 6, 2009 Share Posted November 6, 2009 As far as I know there is no real difference between for or while except for claims of speed Link to comment https://forums.phpfreaks.com/topic/180479-help-with-products-of-pages-products-per-page-etc/#findComment-952219 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.