gabrielkolbe Posted May 8, 2006 Share Posted May 8, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/9312-prevention-of-duplication-on-an-array/ Share on other sites More sharing options...
ober Posted May 8, 2006 Share Posted May 8, 2006 SELECT DISTINCT(supplier_name), other_field1, otherfield2 FROM tablexyz WHERE blah blah Quote Link to comment https://forums.phpfreaks.com/topic/9312-prevention-of-duplication-on-an-array/#findComment-34301 Share on other sites More sharing options...
gabrielkolbe Posted May 8, 2006 Author Share Posted May 8, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/9312-prevention-of-duplication-on-an-array/#findComment-34304 Share on other sites More sharing options...
ober Posted May 8, 2006 Share Posted May 8, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/9312-prevention-of-duplication-on-an-array/#findComment-34308 Share on other sites More sharing options...
gabrielkolbe Posted May 8, 2006 Author Share Posted May 8, 2006 thanks Quote Link to comment https://forums.phpfreaks.com/topic/9312-prevention-of-duplication-on-an-array/#findComment-34313 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.