Jump to content

help regarding products being inserted to database


hance2105

Recommended Posts

hello guys, in fact i have a tbl_product where different retailers insert products - can be same products. all of them have standard name of the product to enter. i have to list the products inserted and their images which is standard as well. how can i write a code so that the list of products is displayed. each product is displayed once only.

 

thank you


<?php

///////////////
//mysql connection here
//////////////


$where = 'CategoryID = 1' // if you have any specifications as to which products need to be pulled.
$order = 'ProductID, ProductName, ProductPrice';
$result = mysql_query("select * from ProductTable where {$where} order by {$order}");


echo '<table style="width: 100%; padding: 0px; margin: 0px; border: 0px;" id="Products">';

while($pline = mysql_fetch_assoc($result)){
echo '<pre>';
print_r($pline);
echo '</pre>';

//that print_r is just to show you what variables you can print out and what not example
echo <<<EOT
<tr>
<td>Product Name:</td>
<td>{$pline['ProductName']}</td>
</tr>
<tr>
<td>Price</td>
<td>{$pline['ProductPrice']}</td>
</tr>
EOT;
}

echo '</table>';

mysql_free_result($result);

?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.