Hi!
I can´t make this query work. First little story about what this query should do:
I have picture searching interface on my company´s website. Some keywords are in english, some are in our language which is finnish. So I made database "translate" which have most of typical search words translated to both languages. So when customer writes a word "cat", it should search also with a word "kissa" which is "cat" in finnish. Well, that is almost easy with this kind of code:
-----------
<cfloop list="#keyword#" delimiters="," index="index1">
<cfquery datasource="#mydsn#" name="translate">
SELECT * from translate
WHERE uk = '#index1#'
OR fin = '#index1#'
</cfquery>
<cfoutput query="translate">
<cfset uk = "#uk#">
<cfset fin = "#fin#">
</cfoutput>
</cfloop>
<cfquery datasource="picturedata" name="finalsearch">
SELECT asset_name, categories
FROM pictures
WHERE
categories LIKE '%#uk#%'
OR categories LIKE '%#fin#%'
</cfquery>
-----------
That search works right when customer use only one keyword. It translate keywords and find pictures with both languages without any problems. But when customer use option to add many words to keyword -field (cat,child,nature) it takes always only the last keyword from the list to search. I know that it´s because the loop, but how can I work with the loop that ALL keywords go to search after translation??
Thanks
I can´t make this query work. First little story about what this query should do:
I have picture searching interface on my company´s website. Some keywords are in english, some are in our language which is finnish. So I made database "translate" which have most of typical search words translated to both languages. So when customer writes a word "cat", it should search also with a word "kissa" which is "cat" in finnish. Well, that is almost easy with this kind of code:
-----------
<cfloop list="#keyword#" delimiters="," index="index1">
<cfquery datasource="#mydsn#" name="translate">
SELECT * from translate
WHERE uk = '#index1#'
OR fin = '#index1#'
</cfquery>
<cfoutput query="translate">
<cfset uk = "#uk#">
<cfset fin = "#fin#">
</cfoutput>
</cfloop>
<cfquery datasource="picturedata" name="finalsearch">
SELECT asset_name, categories
FROM pictures
WHERE
categories LIKE '%#uk#%'
OR categories LIKE '%#fin#%'
</cfquery>
-----------
That search works right when customer use only one keyword. It translate keywords and find pictures with both languages without any problems. But when customer use option to add many words to keyword -field (cat,child,nature) it takes always only the last keyword from the list to search. I know that it´s because the loop, but how can I work with the loop that ALL keywords go to search after translation??
Thanks