Hi Iain, Did you alter the tables since your original message? In the original message, you didn't have a "caption" column in the properties table. It might be easiest if you showed us your current table structures and partial data, like this:
Countries +----------+-----------------------+ | Field | Type | +----------+-----------------------+ | id | integer | | country | varchar(20) | +----------+-----------------------+ Partial data in Countries table +---------+-----------------------+ | id | country | +---------+-----------------------+ | 1 | United Kingdom | | 2 | Spain | | ... | | +---------+-----------------------+ Properties ...etc... Also, I suggest you have an id (or reference_number) field in the countries table. I have found that if you don't, and you need to make a change to a country name, it can become a big mess. Bob -----Original Message----- From: fatblokeonbike [mailto:[EMAIL PROTECTED] Sent: Monday, December 08, 2003 4:39 PM To: Mike Johnson Cc: [EMAIL PROTECTED] Subject: RE: New to joins - this simple one doesn't work. .. > > $Query="SELECT properties.area, images.image_filename FROM > > properties, > > images WHERE properties.reference_number=images.reference_number AND > > properties.area=$id"; > > > > but it doesn't work - I get the usual "...not a valid MySQL > > result resource" > > If you can help, thanks in advance. > >If $id is a string and not an int, then you need to single- or >double-quote it. > >Try this: > >$Query="SELECT properties.area, images.image_filename FROM properties, >images WHERE properties.reference_number=images.reference_number AND >properties.area='$id'"; > >HTH! Well, not really, I'm afraid - the plain $id takes the visitor to the next page with the correct POSTed value in the URL. Alas, alas, adding single or double quotes doesn't solve things. I've shuffled/altered names around in a (fruitless) attempt to correct things but still, clicking on the hyperlink for "Spain" and echoing the $Query and the $Result to screen I get - Query= SELECT properties.caption AS caption, properties.country, properties.area AS area, images.image_filename AS filename FROM properties, images WHERE properties.reference_number=images.reference_number AND properties.country='Spain' Result= i.e. No Result. Boo-hoo. Anything stand out there? Iain. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]