GreenMamba Posted October 22, 2007 Share Posted October 22, 2007 Hi Guys I'm fairly new to PHP and after some trial and error managed to get the rsults I want from the following script, except that now some of the results are being duplicated. <?php $notify_query = tep_db_query("select products_id, products_name from " . TABLE_PRODUCTS_NOTIFICATIONS . " where customers_id = '" . (int)$customer_id . "'"); while ($notify_products = tep_db_fetch_array($notify_query)) { $check_notify = substr($notify_products['products_name'], 0, strpos($notify_products['products_name'], "#")); $shipment_query = tep_db_query("select products_name, products_date_available from " . TABLE_SHIPMENTS . " order by products_name"); while ($shipment_products = tep_db_fetch_array($shipment_query)) { $check_shipment = substr($shipment_products['products_name'], 0, strpos($shipment_products['products_name'], "#")); if ($check_notify == $check_shipment) { $list_products = '<tr class="listing_even"><td class="listing_txt">' . $shipment_products['products_name'] . '</td><td class="listing_txt" align="right">Received ' . $shipment_products['products_date_available'] . '</td></tr>'; } } echo $list_products; } ?> I've tried different variations of array_unique and foreach, but can't get it to work. Any help would be greatly appreciated. Thanks Rudi Link to comment https://forums.phpfreaks.com/topic/74295-duplicate-results/ Share on other sites More sharing options...
Azu Posted October 22, 2007 Share Posted October 22, 2007 Try replace all "select" statements with "select distinct". Link to comment https://forums.phpfreaks.com/topic/74295-duplicate-results/#findComment-375799 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.