PHP/MySql help...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TripleXPrint
    Confirmed User
    • Apr 2007
    • 983

    #1

    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
  • tical
    Confirmed User
    • Feb 2002
    • 6504

    #2
    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 limit 12
    112.020.756

    Comment

    • redwhiteandblue
      Bollocks
      • Jun 2007
      • 2793

      #3
      Change the query line to

      Code:
      $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 limit 12");
      Simples.
      Interserver unmanaged AMD Ryzen servers from $73.00

      Comment

      • TripleXPrint
        Confirmed User
        • Apr 2007
        • 983

        #4
        ROCK & FUCKING ROLL!!!

        Thanks!
        Skype: Triplexprint

        Comment

        • mafia_man
          Confirmed User
          • Jul 2005
          • 1965

          #5
          ..............
          I'm out.

          Comment

          • bbobby86
            partners.sexier.com
            • Jan 2007
            • 11926

            #6
            thread closed...

            Comment

            • sarettah
              see you later, I'm gone
              • Oct 2002
              • 14297

              #7
              Originally posted by bbobby86
              thread closed...
              Until he asks how to get to the next 12 ;p
              All cookies cleared!

              Comment

              • TripleXPrint
                Confirmed User
                • Apr 2007
                • 983

                #8
                Originally posted by sarettah
                Until he asks how to get to the next 12 ;p
                I didn't go full retard here.
                Skype: Triplexprint

                Comment

                • GrouchyAdmin
                  Now choke yourself!
                  • Apr 2006
                  • 12085

                  #9
                  osCommerce is such a pile of shit.

                  Comment

                  • fris
                    Too lazy to set a custom title
                    • Aug 2002
                    • 55679

                    #10
                    Originally posted by GrouchyAdmin
                    osCommerce is such a pile of shit.
                    I think that is your comment towards every piece of software that you didnt create ;)
                    Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

                    Comment

                    • GrouchyAdmin
                      Now choke yourself!
                      • Apr 2006
                      • 12085

                      #11
                      Originally posted by fris
                      I think that is your comment towards every piece of software that you didnt create ;)
                      It's still not as much of a pile of shit as WordPress, though.

                      Comment

                      • Dappz
                        Confirmed User
                        • Dec 2009
                        • 997

                        #12
                        well good luck dude


                        Hentai Artist * Draw My Anime *
                        HentaiLovers * hentaiG4H * ICQ : 657458

                        Comment

                        Working...