Requirements are to take a user-provided list of keywords and return any record that has any keyword in any of 16 fields.
So if the user enters keywords of cup dog bread
(The order of the keywords is not significant and there is no implied relationship between any of them.)
So the WHERE conditions are 78 in number:
WHERE ObjObjectName LIKE '%cup%'
OR ObjObjectName LIKE '%dog%'
OR ObjObjectName LIKE '%bread%'
OR ObjObjectOtherName LIKE '%cup%'
OR ObjObjectOtherName LIKE '%dog%'
OR ObjObjectOtherName LIKE '%bread%'
OR ObjObjectID LIKE '%cup%'
OR ObjObjectID LIKE '%dog%'
OR ObjObjectID LIKE '%bread%'
OR ObjOtherName LIKE '%cup%'
OR ObjOtherName LIKE '%dog%'
OR ObjOtherName LIKE '%bread%'
OR ObjTitle LIKE '%cup%'
OR ObjTitle LIKE '%dog%'
OR ObjTitle LIKE '%bread%'
OR ObjCategory LIKE '%cup%'
OR ObjCategory LIKE '%dog%'
OR ObjCategory LIKE '%bread%'
OR AccCreditLineLocal LIKE '%cup%'
OR AccCreditLineLocal LIKE '%dog%'
OR AccCreditLineLocal LIKE '%bread%'
OR PrimaryCreator LIKE '%cup%'
OR PrimaryCreator LIKE '%dog%'
OR PrimaryCreator LIKE '%bread%'
OR EdiPublisherLocalSummary LIKE '%cup%'
OR EdiPublisherLocalSummary LIKE '%dog%'
OR EdiPublisherLocalSummary LIKE '%bread%'
OR EdiPlaceOfPublication LIKE '%cup%'
OR EdiPlaceOfPublication LIKE '%dog%'
OR EdiPlaceOfPublication LIKE '%bread%'
OR CreContinent LIKE '%cup%'
OR CreContinent LIKE '%dog%'
OR CreContinent LIKE '%bread%'
OR CreSubContinent LIKE '%cup%'
OR CreSubContinent LIKE '%dog%'
OR CreSubContinent LIKE '%bread%'
OR CreCountry LIKE '%cup%'
OR CreCountry LIKE '%dog%'
OR CreCountry LIKE '%bread%'
OR CreRegion LIKE '%cup%'
OR CreRegion LIKE '%dog%'
OR CreRegion LIKE '%bread%'
OR CreCounty LIKE '%cup%'
OR CreCounty LIKE '%dog%'
OR CreCounty LIKE '%bread%'
OR CreStateProvince LIKE '%cup%'
OR CreStateProvince LIKE '%dog%'
OR CreStateProvince LIKE '%bread%'
OR CreCity LIKE '%cup%'
OR CreCity LIKE '%dog%'
OR CreCity LIKE '%bread%'
OR CreContinent1 LIKE '%cup%'
OR CreContinent1 LIKE '%dog%'
OR CreContinent1 LIKE '%bread%'
OR CreSubContinent1 LIKE '%cup%'
OR CreSubContinent1 LIKE '%dog%'
OR CreSubContinent1 LIKE '%bread%'
OR CreCountry1 LIKE '%cup%'
OR CreCountry1 LIKE '%dog%'
OR CreCountry1 LIKE '%bread%'
OR CreRegion1 LIKE '%cup%'
OR CreRegion1 LIKE '%dog%'
OR CreRegion1 LIKE '%bread%'
OR CreCounty1 LIKE '%cup%'
OR CreCounty1 LIKE '%dog%'
OR CreCounty1 LIKE '%bread%'
OR CreStateProvince1 LIKE '%cup%'
OR CreStateProvince1 LIKE '%dog%'
OR CreStateProvince1 LIKE '%bread%'
OR CreCity1 LIKE '%cup%'
OR CreCity1 LIKE '%dog%'
OR CreCity1 LIKE '%bread%'
OR CreDateCreated LIKE '%cup%'
OR CreDateCreated LIKE '%dog%'
OR CreDateCreated LIKE '%bread%'
OR CreMarkSignature LIKE '%cup%'
OR CreMarkSignature LIKE '%dog%'
OR CreMarkSignature LIKE '%bread%'
Is this really the best way to do this? I mean, I plan to use PDO prepared statements and I found this Q&A (LIKE query using multiple keywords from search field using PDO prepared statement) which will be very helpful, but I am relatively inexperienced with MySQL so I wasn't sure if there was better way to handle all those where conditions. Thanks!