pangea
Mar 21st 2007, 3:08 pm
Hi,
Can anyone tell me the correct syntax to search for values above or equal to the entered amount in a form:
<?
$SHQuery = "select * from add_property where ";
if($_REQUEST[status]!=""){
$SHQuery.= "status like '%$_REQUEST[status]%' and ";
}
if($_REQUEST[city]!=""){
$SHQuery.= "city like '%$_REQUEST[city]%' and ";
}
if($_REQUEST[state]!=""){
$SHQuery.= "state like '%$_REQUEST[state]%' and ";
}
if($_REQUEST[country]!=""){
$SHQuery.= "country like '%$_REQUEST[country]%' and ";
}
if($_REQUEST[bedrooms]!=""){
$SHQuery.= "bedrooms between '%$_REQUEST[bedrooms]%' and ";
}
$SHQuery = substr($SHQuery, 0, -4) ;
//echo $SHQuery;die();
$SHResult= mysql_query($SHQuery) or die(mysql_error());
if(mysql_num_rows($SHResult)>0){
?>
I tried >= and <= and greater than but it doesnt work!!
would appreciate any ideas - thanks guys!
Can anyone tell me the correct syntax to search for values above or equal to the entered amount in a form:
<?
$SHQuery = "select * from add_property where ";
if($_REQUEST[status]!=""){
$SHQuery.= "status like '%$_REQUEST[status]%' and ";
}
if($_REQUEST[city]!=""){
$SHQuery.= "city like '%$_REQUEST[city]%' and ";
}
if($_REQUEST[state]!=""){
$SHQuery.= "state like '%$_REQUEST[state]%' and ";
}
if($_REQUEST[country]!=""){
$SHQuery.= "country like '%$_REQUEST[country]%' and ";
}
if($_REQUEST[bedrooms]!=""){
$SHQuery.= "bedrooms between '%$_REQUEST[bedrooms]%' and ";
}
$SHQuery = substr($SHQuery, 0, -4) ;
//echo $SHQuery;die();
$SHResult= mysql_query($SHQuery) or die(mysql_error());
if(mysql_num_rows($SHResult)>0){
?>
I tried >= and <= and greater than but it doesnt work!!
would appreciate any ideas - thanks guys!