Barry, On Thu, Jul 24, 2003 at 11:22:28PM -0500, Barry Hayden wrote: > I have to admit I am very much a newbie at MySQL in general (but I'm > working on it). > > I have a fairly complex (for me) query that I am trying to complete > using php. I can't get it to work, and I'm sure it's just in the way I > am phrasing the MySQL part of this. The premise of this is a four > question form that acts as a search engine to draw the appropriate > information out of the db. If anyone could help I would really > appreciate it. Here's what I have. > > <?php > $conn = mysql_connect($server, $user, $pass); > $select = mysql_select_db(realty, $conn); > $sql = "SELECT Realtor, HouseAddress, Bathrooms, Bedrooms, YearBuilt, > Garage, Location, Basement, Info FROM properties > WHERE Bathrooms =='".$a."'", "Bedrooms =='".$b."'", "Garage > =='".$c."'", > "Basement =='".$d."'";
Use = for equality tests in MySQL, not == like in most programming languages. Check for errors with mysql_error(). > $result = mysql_query($sql, $conn); > while ($record = mysql_fetch_assoc($result)){ > while (list($fieldvalue) = each ($record)) > echo $fieldname.; I'm not sure what the point (.) is doing here. Check for error messages in the webserver logs. > } > if (mysql_num_rows($result) ==0){ > echo "Sorry, no matching results."; > } > ?> > Regards, Fred. -- Fred van Engen XB Networks B.V. email: [EMAIL PROTECTED] Televisieweg 2 tel: +31 36 5462400 1322 AC Almere fax: +31 36 5462424 The Netherlands -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]