php - SQL Query Price Compare -
i running sql query seach database. can search until compare prices.
working code without price compare
$query = "select * propertie_ids (`search` '%".$searchquery."%') , (`location` = '$location') , (`bathroom` = '$bathroom') , (`bedroom` = '$bathroom');
broken code price compare
$query = "select * propertie_ids (`search` '%".$searchquery."%') , (`location` = '$location') , (`bathroom` = '$bathroom') , (`bedroom` = '$bathroom') , price between ('0') , ('10000000000')";
any ideas why not work, have checked , tables named correctly.
single quote denote strings in sql, using them cause query lexicographical comparison. if remove them, you'll have numerical comparison meant. additionally, since have price
string, you'd need cast too.
$query = "select * propertie_ids (`search` '%".$searchquery."%') , (`location` = '$location') , (`bathroom` = '$bathroom') , (`bedroom` = '$bathroom') , cast (price decimal) between (0) , (10000000000)";
Comments
Post a Comment