emptypixels
Programmer
I'm trying to construct a query in PHP that will be able to handle multiple search fields. The data is in multiple tables.
COMPANY
company_id
name
address
SERVICE TYPE
company_id
service
OFFICE LOCATIONS
company_id
city_name
My question is how do I construct a query that will allow there to be these three search fields (company name, service type, location).
I know that subqueries are probably needed, but I'm a newbie and still not quite clear how to get these to work properly.
The queries I've been able to construct return zero results unless all fields are filled in, or they return multiple listings of the company name since the company may have more than one office location.
I don't want the user to be required to fill in all fields to get meaningful results.
Can anyone point me in the right direction?
COMPANY
company_id
name
address
SERVICE TYPE
company_id
service
OFFICE LOCATIONS
company_id
city_name
My question is how do I construct a query that will allow there to be these three search fields (company name, service type, location).
I know that subqueries are probably needed, but I'm a newbie and still not quite clear how to get these to work properly.
The queries I've been able to construct return zero results unless all fields are filled in, or they return multiple listings of the company name since the company may have more than one office location.
I don't want the user to be required to fill in all fields to get meaningful results.
Can anyone point me in the right direction?