Hello,
I have just started PHP programming, and am stuck on keyword searching. I'm trying to create a basic search box that would allow a visitor to type multiple keywords, and have the system search in a specific database field for those keywords. I've done a similar thing in ColdFusion, in which I used the following code to loop through the products, attributes, and company for each keyword:
<cfloop list="#Form.Item#" index="searchterm" delimiters=" ">
AND (Items.Product LIKE '%#searchterm#%'
OR Items.Attributes LIKE '%#searchterm#%'
OR Companies.Company LIKE '%#searchterm#%')
</cfloop>
Does anyone know of an equivalent in PHP? I thought about using split(" ", $searchterm) to split the keywords into an array and searching through the array in a loop, but I'm not sure where to go from there. Any ideas, or a better suggestion?
Thanks greatly in advance for your assistance.
Susan
I have just started PHP programming, and am stuck on keyword searching. I'm trying to create a basic search box that would allow a visitor to type multiple keywords, and have the system search in a specific database field for those keywords. I've done a similar thing in ColdFusion, in which I used the following code to loop through the products, attributes, and company for each keyword:
<cfloop list="#Form.Item#" index="searchterm" delimiters=" ">
AND (Items.Product LIKE '%#searchterm#%'
OR Items.Attributes LIKE '%#searchterm#%'
OR Companies.Company LIKE '%#searchterm#%')
</cfloop>
Does anyone know of an equivalent in PHP? I thought about using split(" ", $searchterm) to split the keywords into an array and searching through the array in a loop, but I'm not sure where to go from there. Any ideas, or a better suggestion?
Thanks greatly in advance for your assistance.
Susan