Jump to content

Archived

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

gabrielkolbe

prevention of duplication on an array

Recommended Posts

Hi, I would be grateful if someone can help me here, I am querying an table with several different suppliers in, how do I echo out an array without repeating the same supplier twice, does any one know of such an function??
I would be grateful.

Thanks

Share this post


Link to post
Share on other sites
SELECT DISTINCT(supplier_name), other_field1, otherfield2 FROM tablexyz WHERE blah blah

Share this post


Link to post
Share on other sites
Hi, thanks for the answer, but it is not what I want, I don't want / need a SQL solution to the problem the solution must be a PHP solution.

Share this post


Link to post
Share on other sites
That's the most efficient way to achieve your required results, so that's what I provided. You didn't specify.

array_unique will probably get you what you want, but I'm going to assume that's probably to simple for what you're after, so the only thing left is to copy used array values to a temp array and then use in_array to check that for "used" array values.

Share this post


Link to post
Share on other sites

×

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.