You are here: Re: [PHP] looping through an array problem « PHP « IT news, forums, messages
Re: [PHP] looping through an array problem

Posted by Paul Waring on 06/05/05 23:49

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация