JOIN - Not working.

From: Date: Wed, 28 Nov 2001 09:11:05 +0000
Subject: JOIN - Not working.
Groups: php.db 
Request: Send a blank email to php-db+get-14642@lists.php.net to get a copy of this message
I have read the parts of the manual(s) but am just not grasping something... I have 2 tables, one holds the Property ID etc., and the other holds all the Property Details. They are connected by a field called 'PropertyID' which is a unique ID that appears in both records. I want to count the number of records in PropertyDetails that have an entry in a field called 'Image1Desc', but I need to do this based on a previously chosen field from Property called 'PropertyType'. However, the code below is simply not giving the results I need: $phselect = "select COUNT(*) AS phTotal from properties LEFT JOIN propertydetails ON properties.PropertyID=propertydetails.PropertyID where ((propertydetails.Image1Desc='') AND (properties.PropertyType='$PropertyType'))"; $phresult = mysql_query ($phselect,$conID); while ($phrow = mysql_fetch_array($phresult)) { $phTotal = $phrow["phTotal"]; PRINT "<td align=\"right\">$phresult</td>\n"; } // end WHILE Is there an obvious problem here and can anyone help? Martin E. Koss M: 07946-706459 E: mek@mek.co.uk

« previous php.db (#14642) next »