Jump to content

Snytax error in a complex SQL query


musicmaker001

Recommended Posts

This is the SQL code I am using.

 

SELECT mlsID, city, price, status, `class`, bedrooms, fullBaths, halfBaths, sqftHtd, remarks, levels, listOffice, virtualTour, `state`
FROM 'dB'
WHERE mlsID = 'mls' OR price BETWEEN 'priceLow' AND 'priceHigh' AND bedrooms >= 'beds' AND fullBaths >= 'baths' AND city LIKE '%"city"', sqftHtd >= 'sqft'
ORDER BY price, city;

 

There are variables passed to this query from the preceeding search page. (mls, priceLow, priceHigh, beds, baths, city and sqft)

 

 

 

When I process the form I get this error.

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''RESIDENTIAL' WHERE mlsID = NULL OR price BETWEEN '200000' AND '400000' AND bedr' at line 1

 

 

 

I have been trying to solve this error for the last 3 hours, now it's time to seek the help of folks that are smarter than me! :-)

Link to comment
https://forums.phpfreaks.com/topic/281270-snytax-error-in-a-complex-sql-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.