Comparing a list with a query output
I may just be really tired, but I'm just not getting this. What I'm trying to accomplish is to output a query, and as it's outputting, check a list to see if a value exists, and if so, change the class of a <li>
I have two queries and am defining a list from one:
<cfquery name="rsTags" datasource="cfsfwer">
SELECT tags.tagName, tags.tagsID
FROM tags, blogTagLink
WHERE blogTagLink.blogID = <cfqueryparam value="#SESSION.blogID#" cfsqltype="cf_sql_numeric">
AND tags.tagsID = blogTagLink.tagID
</cfquery>
<cfset selectedTags = ValueList(rsTags.tagsID)>
<cfquery name="rsAllTags" datasource="cfsfwer">
SELECT *
FROM tags
ORDER BY tags.tagName
</cfquery>
So far this works just fine. The output of #selectedTags# is correct. Now I want to output #rsAllTags# and check to see if the record is ALSO in the #selectedTags# list, and if it is, change the class on the output, like this
<ul>
<cfoutput query="rsAllTags">
<cfset temp = ListFind(selectedTags, #rsAllTags.tagsID#)>
<cfif temp EQ 0>
<li class="tagnotselected""><a>#rsAllTags.tagName#</a></li>
<cfelse>
<li class="tagselected""><a>#rsAllTags.tagName#</a></li>
</cfif>
</cfoutput>
</ul>
It doesn't work, and it is related to the variable #rsAllTags.tagsID#. If I use a static value for this, it works fine. Obviously, I need a dynamic value to deal with the output query.
Any help would be appreciated.
