I am having an issue with the sytnax on how to get a value from a database and then check that value in an if statement in ColdFusion
This is what I have so far:
<cfquery name="reserveCheck" datasource="RC">
SELECT comp_type FROM partnerCompany WHERE comp_ID = "#COOKIE.RISOURCEUSRID#"
</cfquery>
<cfoutput>
<cfif #reserveCheck# NEQ 4>
<li><a href="http://mywebsite/gonow/index.cfm" title="Product Search" target="_blank">Product Search</a></li>
</cfif>
</cfoutput>
Change this:
<cfif #reserveCheck# NEQ 4>
to this
<cfif reserveCheck.comp_type NEQ 4>
This assumes your query only returns one row. If the query returns more than one row, the code in this answer only looks at the first row. That may or may not be what you want.