MySQL between Problem
Posted: Fri Apr 07, 2006 5:34 pm
I am using this query for an advanced search on a page with many parameters
The query seems to be working as far as this part of the query goes
but then when the BETWEEN part of the query starts it doesnt narrow down the results based on those parameters. Any help on this will be appreciated. Thanks
Code: Select all
SELECT * FROM homes WHERE home_cty='$cy_id' AND home_city='$cty_id' AND home_status='$home_status' AND home_ptype = '$home_ptype1' OR home_ptype = '$home_ptype2' OR home_ptype = '$home_ptype3' OR home_ptype = '$home_ptype4' AND home_bed BETWEEN '$beds_from' AND '$beds_to' AND home_bth BETWEEN '$baths_from' AND '$baths_to' AND home_value BETWEEN '$from_price' AND '$to_price' order by home_idCode: Select all
SELECT * FROM homes WHERE home_cty='$cy_id' AND home_city='$cty_id' AND home_status='$home_status' AND home_ptype = '$home_ptype1' OR home_ptype = '$home_ptype2' OR home_ptype = '$home_ptype3' OR home_ptype = '$home_ptype4'