Re: looping through an array problem

From: Date: Sun, 05 Jun 2005 20:49:36 +0000
Subject: Re: looping through an array problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-216431@lists.php.net to get a copy of this message
On 6/5/05, Jack Jackson <jackson.linux@gmail.com> wrote: > I'd like to stop the NY Sun from appearing twice! What have i missed here? There's nothing wrong with your PHP code as such (although you could filter out duplicates there if you wanted), all you should need to do is add the DISTINCT keyword to your SQL query on the appropriate colum like so: SELECT art.art_id,art.publisher_id, DISTINCT publisher.publisher_name, FROM art LEFT JOIN publisher ON publisher.publisher_id=art.publisher_id I believe the DISTINCT keyword is part of the SQL standard, so it should work on MySQL, Postgres etc. Hope this helps. Paul -- Rogue Tory http://www.roguetory.org.uk

« previous php.general (#216431) next »