Jump to content

help regarding products being inserted to database


hance2105
Go to solution Solved by chriscloyd,

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

Link to comment
Share on other sites

  • Solution


<?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);

?>

 

Edited by chriscloyd
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.