I am new to PHP programing and have a problem which is making me run around in circles.
basically I have 3 fields that the user can input to find a company by name, town or postcode or even combined field search.
heres my code
$result= mysql_query("SELECT * FROM $table WHERE company like '$search_company%' OR town = '$search_town' OR postcode = '$search_postcode' ORDER BY company") OR die("No Records Matched!");
when I want to do a search using the company field, it displays all records to the nearest match of my input. (this is fine), but when I want to do a search in the town or postcode field, it displays all the records in my table and doesn't perform the same search as for the company field.
is there something missing from my code?
Thks in advance