On 11-Jun-01 Dawn H wrote:
>>Ahh. 'it doesn't work.'
>>As in: it returns a error ? or doesn't display you what you want ?
> 
> Both. I've fiddled with it doing this and that and haven't been able to get
> it to display correctly.
> 

do the cut-n-paste thingy & get your query correct first; sweat display later.

>>> ----BEGIN QUOTE-----
>>>       $sth=$dbh->prepare ("SELECT listing.id, pictures.thumb_1,
> description.mls,
>>> listing.p_city, listing.p_state, listing.p_zip, description.price from
>>> listing, description, pictures");
> 
>>And the tables are related how ? Shouldn't there be a WHERE a.id=b.id
>>somewhere in there ?
> 
> Exactly what I'm trying to find out :-) I found in the book how to relate
> two
> tables that way, but I need four.
> 

Same way:

select a.name,b.foo,c.bar,d.baz
   FROM a,b,c,d where a.id=b.id and a.id=c.id and a.id=d.id;

>>Also a good practice is:
>>  $debug=1;
>>  $qry="select ... from ... where ...";
>>  print "\ndebug: $qry \n" if $debug;
>>  $sth->prepare($qry);
> 
>>Then cut-n-paste the debug output into the mysql client to make sure of the
>>results.
> 
> ok, I'll try that, thank you!
> 
>>>       $sth->execute()
>>>       or bail_out("Can't get listings");
> 
>>Very informative.
> 
> The bail_out subroutine is the one that is in Paul DuBois' book "MySQL". It
> displays the DBI error message.
> 

;) sorry, no telling from here.

>>>       print "<TABLE>";
>>>       while (($id, $thumb, $mls, $p_city, $p_state, $p_zip, $price) =
>>> $sth->fetchrow_array())
>>>       {
>>>       print "<TR><TD>";
>>>       show_thumb($id);
> 
>>Does show_thumb() make another db query while you are looping on this
>>result-set ? Or did you mean show_thumb($thumb) ?
> 
> Yes, it does a separate query.
> 

Then you'll need a separate DBI handle to keep from stomping on your mls
results.

> It's practically impossible to look at a penguin and feel angry. --Joe Moore

or Chuck ...

Regards,
-- 
Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to