I run a real estate office, and am doing a new property search page, and have added a Reference No. search, extra to an area, type, bedrooms and price one that is already working ok.
I am having trouble getting the right statement working.
I need the script to work, that if someone asks for a ref.no search, it cancels out them picking any other search eg: bedrooms area etc.
So basically, if they pick an area search they cannot pick a ref.no. search, but if they pick a ref.no search it shows that property with that ref.no.
Hope someone can help.
The bit i have tried to implement is between the #####
The code above it works ok without the ref.no bit.
Code: Select all
//echo "area=$area type=$type bedromms=$bedrooms price=$price ref=$ref dsds=$saklj ";
$querytmp="select * from prop";
$where=0;
if ($area !=0)
{
$querytmp.=" where area=$area";
$where=1;
}
if ($type !=0)
{
if ($where == 0)
{
$querytmp.=" where";
$where=1;
}
else
{
$querytmp.=" and";
}
$querytmp.=" type=$type";
}
if ($bedrooms !=0)
{
if ($where == 0)
{
$querytmp.=" where";
$where=1;
}
else
{
$querytmp.=" and";
}
$querytmp.=" bedrooms=$bedrooms";
}
###################
if ($ref !=0)
{
if ($where == 0)
{
$querytmp.=" where";
$where=0;
}
else
{
$querytmp.=" and";
}
$querytmp.=" ref=$ref";
}
####################################