AGazzaz Posted December 19, 2007 Share Posted December 19, 2007 Hello,I want to enable the user to search by both price and area in the same time by entering price and area rangesuntil now I can search any of those two using "between" but I can not use 2 "between" in one queryIs that possible?If it is not What is the alternative?Thank you in advance Link to comment Share on other sites More sharing options...
justsomeguy Posted December 19, 2007 Share Posted December 19, 2007 but I can not use 2 "between" in one queryWhy not? Link to comment Share on other sites More sharing options...
AGazzaz Posted December 19, 2007 Author Share Posted December 19, 2007 Why not?I guess it is a syntax error$result = mysql_query("SELECT * FROM price WHERE price BETWEEN $price1 AND $price2 AND area BETWEEN $area1 AND $area2") or die(mysql_error()); Is there a problem with this query? Link to comment Share on other sites More sharing options...
justsomeguy Posted December 19, 2007 Share Posted December 19, 2007 You might need to add parens for clarity. $result = mysql_query("SELECT * FROM price WHERE (price BETWEEN $price1 AND $price2) AND (area BETWEEN $area1 AND $area2)") or die(mysql_error()); There might also be an issue because you named a field the same thing as the table. Link to comment Share on other sites More sharing options...
AGazzaz Posted December 20, 2007 Author Share Posted December 20, 2007 I found what was the problem, it was not the syntax of the query or the name of the table the whole problem was that I wrote$area2 = floatval($_post['area2'];instead of:$area2 = floatval($_POST['area2'];thank you very much for your help justsomeguy, You are the BEST!!!. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.