Hi guys,
I want to highlight any word in my text that matches a word that is in a database table. So if in the table words are: sun / web / ghost then i want in the text these words highlighted.
Now only the top record is matching so in this example sun.
How can i change the code so that any word in the table sun / web / ghost matches with the text ?
CODE:
cfquery:
---------------------------------------------------------
<cfquery name="zo" datasource="spirilog">
SELECT *
FROM onderwerpen
ORDER BY Id DESC</cfquery>
---------------------------------------------------------
text formatting:
---------------------------------------------------------
<cfset MessageComments = "#Replace(MessageComments, '#zo.titel#', '<a href="index.cfm?id=#zo.id#&spot=#zo.echtenaam#" title="Bekijk en/of bewerk de definitie van #zo.titel#..."><span class="style3">#zo.titel#</span></a>', 'ALL')#">
---------------------------------------------------------
I know that i have to change the query in something like:
<cfquery name="zo" datasource="spirilog">
SELECT *
FROM onderwerpen where titel (the word that have to match with the text) = like ??? (any matched word in the text)
ORDER BY Id DESC</cfquery>
Can anyone help ?
I want to highlight any word in my text that matches a word that is in a database table. So if in the table words are: sun / web / ghost then i want in the text these words highlighted.
Now only the top record is matching so in this example sun.
How can i change the code so that any word in the table sun / web / ghost matches with the text ?
CODE:
cfquery:
---------------------------------------------------------
<cfquery name="zo" datasource="spirilog">
SELECT *
FROM onderwerpen
ORDER BY Id DESC</cfquery>
---------------------------------------------------------
text formatting:
---------------------------------------------------------
<cfset MessageComments = "#Replace(MessageComments, '#zo.titel#', '<a href="index.cfm?id=#zo.id#&spot=#zo.echtenaam#" title="Bekijk en/of bewerk de definitie van #zo.titel#..."><span class="style3">#zo.titel#</span></a>', 'ALL')#">
---------------------------------------------------------
I know that i have to change the query in something like:
<cfquery name="zo" datasource="spirilog">
SELECT *
FROM onderwerpen where titel (the word that have to match with the text) = like ??? (any matched word in the text)
ORDER BY Id DESC</cfquery>
Can anyone help ?