hance2105 Posted June 24, 2013 Share Posted June 24, 2013 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 https://forums.phpfreaks.com/topic/279518-help-regarding-products-being-inserted-to-database/ Share on other sites More sharing options...
ginerjm Posted June 24, 2013 Share Posted June 24, 2013 It's a simple table query. Usually people post their attempt at the code here and tell us what is wrong and we point them in the right direction. Take a stab at it. Link to comment https://forums.phpfreaks.com/topic/279518-help-regarding-products-being-inserted-to-database/#findComment-1437687 Share on other sites More sharing options...
chriscloyd Posted June 25, 2013 Share Posted June 25, 2013 <?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); ?> Link to comment https://forums.phpfreaks.com/topic/279518-help-regarding-products-being-inserted-to-database/#findComment-1437734 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.