I'm using mysql and if I have:
$location = "New York-New York";
$sql = "SELECT * from ads WHERE (ad_location = '$location') AND (status = 'active')";
I know a record with an ad_location of "New York-New York" will display here (the location I want to match is "New York-New York"). But, if I have a record in DB with "New York-New York||Texas-Dallas" as an ad_location, the record will not display (I guess unless I'm searching for New York-New York||Texas-Dallas, but that's not going to happen). And I want all records in the ad_location field containing $location to display.
Do I need to read the entire database and then expand all the records (with '||') to find matches to "New York-New York" with multiples? I hope not.
Any suggestions would be really helpful. Thanks.
I guess I could not have multiple entries in ad_location. Instead, I could insert a new row which is a duplicate row, except for data in the ad_location field. This doesn't sound efficient though.