Advanced Search

Results 1 to 2 of 2

Thread: how can i make a product list i.e. customer can see all products from list and select

  1. #1
    Join Date
    Jan 2012
    Posts
    42
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Question how can i make a product list i.e. customer can see all products from list and select

    creating dynamic product list in php. i.e. customer can see all products from list and select the products.i have created a list from where customer can see the newest 6 products. but its also necessary in list that they can view all the products and select as much item as necessary from list and add them to cart. my code is given below:

    Code:
    <?php 
    // Run a select query to get latest 6 items
    //connect to database
    include ("db.php");
    $dynamicList="";
    $sql = mysql_query ("SELECT * FROM products ORDER BY date_added DESC limit 6");
    $productCount= mysql_num_rows($sql);//count output amount
    if ($productCount>0){
    	while ($row=mysql_fetch_array($sql)){
    		$id=$row["id"];  
    		$product_name=$row["product_name"];
    		$price=$row["price"];
    		$date_added=strftime("%b %d,%Y",strtotime($row["date_added"]));
    	 	$dynamicList.='<table width="100%" border="0" cellpadding="6" cellspacing="0"><tr><td width="17%" valign="top"><a href="product.php?id='.$id.'"><img style="border:#666 ipx solid;" src="inventory_images/'.$id.'.jpg" alt="'.$product_name.'" width="77" height="102" border="1"/></a></td><td width="83%" valign="top">'.$product_name.'<br /> TK'.$price.'<br />
                    <a href="product.php?id='.$id.'">View Product Details</a></td></tr>
                	</table>';
    	}
    }
    	
    	else {
    		$dynamicList="We have no products listed in our store yet";
    	}
    mysql_close();//closes an available open connection found by php	
    ?>
    how can i make it more acceptable, more reliable and more dynamic??
    Last edited by keyboard1333; 10-01-2012 at 10:04 PM. Reason: Format: [code][/code] Tags

  2. #2
    Join Date
    May 2010
    Posts
    81
    Thanks
    21
    Thanked 2 Times in 2 Posts

    Default

    How experienced at php are you? Did you write this code, and your question isn't quit clear. Are you asking how can you write code so users can select multiple products to enter into a shopping cart at one time AND see all the products instead of only 6?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •