View Single Post
Old 03-30-2011, 01:33 PM  
TripleXPrint
Confirmed User
 
TripleXPrint's Avatar
 
Join Date: Apr 2007
Posts: 983
PHP/MySql help...

I'm setting up a new store using CMS to sell sex toys, movies, etc. An online adult store specializing in niche oddities and arousals. I have it set up so all of the products show up on the main page under most popular products. However, it will not stop listing them so when I have 500 products, my index body content has 500 products. I want to stop the display at 12 items. Below is the code, how do I change it so it stops after 12 products are displayed?

Code:
    <div id="our_prod">
    <h1>popular products</h1>
  <?
  $selprod=mysql_query("select p.products_id,pd.products_name ,p.products_image from products p,products_description pd where p.products_id=pd.products_id and pd.language_id=1 and p.special_status=1 and p.left_status");
  $cx=0;
  while($selprodD=mysql_fetch_array($selprod)){
  $cx=$cx+1;
  ?>
    <div <? if($cx%4==1){?>class="prod_dis" <? } else{?>class="prod_dis"<? }?>>
    <div class="tlt"><?=$selprodD['products_name'];?></div>
     <div class="img"><a href="#"><img src="images/<?=$selprodD['products_image'];?>" alt=""  width="125" height="65"/></a></div>
    <div class="btn"> <a href="<?=tep_href_link("product_info.php","products_id=".$selprodD['products_id']); ?>"><img src="images/buy_now_btn.gif" alt="" /></a></div>
       </div>
Thanks in advance!
__________________
Skype: Triplexprint
TripleXPrint is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote