Hi there guys, I am having a little trouble with the following query.
$result = mysql_query("SELECT * FROM members WHERE location1 LIKE '$term' OR location2 LIKE '$term' OR location3 LIKE '$term' OR location4 LIKE '$term' OR location5 LIKE '$term' OR location6 LIKE '$term' OR location7 LIKE '$term' OR location8 LIKE '$term' OR location9 LIKE '$term' OR location10 LIKE '$term' ")
or die(mysql_error());
I have 10 locations with a prefix's defined within the database, these are for post code areas.
e.g. Aberdeen = AB
At the moment I am getting the correct results if the user submits for form with $term = AB but if someone types AB1 this will fail and not return any results. Not sure if there is anyway that I can trim the $term to allow 2 char's. If I use the wild card % I will receive too many results as a will exist within another post area. e.g. LA.
Kind of stuck at the moment of where to go.
Any help would be much appreciated.
Kind Regards,
Rich Lacey