Re: looping through an array problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/5/05, Jack Jackson <jackson.linux@xxxxxxxxx> 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux