I have 3 form fields airport location, price and type
I want users to be able to serach by a combination of criteria.
The first and last queries work ok, the ones in between return nothing, yet
they should return true because data exists for them.
Id be very grateful if anyone can suggest a way forward.
TIA
rob
if($searchlocation || $searchprice || $accommtype){
$query = "select * from customers, hoteldetail where hoteldetail.airport
like '$searchlocation' and hoteldetail.price like '$searchprice%' and
hoteldetail.e_type like '$accommtype' and hoteldetail.custid =
customers.custid " ;
$result = mysql_query($query);
}
if($searchlocation || $searchprice || !$accommtype){
$query = "select * from customers, hoteldetail where
hoteldetail.airport like '$searchlocation' and hoteldetail.price like
'%$searchprice%' and hoteldetail.custid = customers.custid " ;
$result = mysql_query($query);
}
if($searchlocation || !$searchprice || !$accommtype){
$query = "select * from customers, hoteldetail where
hoteldetail.airport like '$searchlocation%' and hoteldetail.custid =
customers.custid " ;
$result = mysql_query($query);
}
if (!$searchlocation || $searchprice || $accommtype){
$query = "select * from customers, hoteldetail where hoteldetail.price
like '$searchprice%' and hoteldetail.e_type like '$accommtype' and
hoteldetail.custid = customers.custid " ;
$result = mysql_query($query);
}
if ($searchlocation || !$searchprice || $accommtype){
$query = "select * from customers, hoteldetail where hoteldetail.airport
like '$searchlocation' and hoteldetail.e_type like '$accommtype' and
hoteldetail.custid = customers.custid " ;
$result = mysql_query($query);
}