Jump to content

Duplicate Results


GreenMamba

Recommended Posts

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

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.