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

Posted by Jack Jackson on 06/06/05 02:34

Ah. I just remembered one reason I had done it involving the art_id field:

I have more publishers in the db than are currently associated with
artworks. I don't want a publisher to appear unless there is at least
one image associated with it. So I did this to avoid having people see a
link to the Sneezy Acres Tribune only to arrive at the next page and
see, "There are no images associated with this publisher."




Jochem Maas wrote:
> Jack Jackson wrote:
>
>>
>>
>> M. Sokolewicz wrote:
>>
>>> Jack Jackson wrote:
>>>
>>>> Thanks for all the replies. Jochem, thank you for this code, which
>>>> will take me all night to understand (though I bet it works). I also
>>>> note that SELECT DISTINCT worked here, too
>>>>
>>>> Also as many of you noticed before me, the art_id was in there as a
>>>> fly in the ointment.
>>>
>>>
>>>
>>> by that statement I ment the exact same thing Jochem ment in his 2nd
>>> part; I have NO idea why you're selecting *ANYTHING* from the arts
>>> table... it's *useless* if you don't need the data...
>>
>>
>>
>> Er, yes, that was what I meant: I had unintentionally included that
>> bit.Thank you for your help.
>>
>
> Er, Jack - your original query was:
>
> SELECT art.art_id,art.publisher_id,publisher.publisher_name,
> FROM art
> LEFT JOIN publisher
> ON publisher.publisher_id=art.publisher_id
>
> which is a selection on the art table... ( with a typo)
> if you did:
>
> SELECT art.publisher_id,publisher.publisher_name
> FROM art
> LEFT JOIN publisher
> ON publisher.publisher_id=art.publisher_id
>
> nothing would change. and if you did:
>
> SELECT publisher.publisher_id,publisher.publisher_name
> publisher
>
> i.e. not 'unintentionally' selecting from the arts table.
> then you would not have had a problem in the first place?!
>
> I think I'm missing something ;-)
>

 

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

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