Re: looping through an array problem

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

 



Forgive me if this comes twice: my ISP had a service blackout for three hours and I don't know what went:


If my last post read (and I see that it did) that I was defending myself
as opposed to falling ALL OVER my sword, I apologize: allow me to be clear:

No, you're all correct and M. Sokolewicz doubly so: I had
unintentionally selected fields from the wrong table for no reason other
than  lack of sleep coupled with lack of experience and a desperation to
try to understand

The problem was that I was pulling data in a manner both useless and
complex from a thoroughly unnecessary table (I could tell you all why
but you'll all just laugh at me more)

I am grateful for all the help everyone has offered up to now and hope I
did not offend  - I was trying in my last post to indicate that I  was
an idiot, and it appears I've come off as arrogant. I promise it was not
my intent!


[Then I wrote::]

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 ;-)


--
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