Concatenate search fields
Posted on 2004-09-15
I'm building my web site using php and mysql. I'm converting an exiting website from ASP/MS ACCESS. I'm having a problem with a simple select statement that utilises two drop down select boxes and one single keyword box. The results from the drop down boxes (County and License fields) work well. The single keyword box, which searches several fileds (Company, Title, Description), produces syntax errors. This is the code I'm trying to write on the results page:
$query_rsSearch = sprintf("SELECT * FROM projects WHERE County LIKE '%%%s%%' AND License LIKE '%%%s%%' AND Company+','+Title+','+Description+' LIKE '%%%s%%'", $varcounty__rsSearch,$varlicense__rsSearch,$varkeyword__rsSearch);
Any suggestions on how to correct this world be appreciated.