Comparing Query Results to check off checkboxs. How do i do this?
Posted on 2006-04-05
Got what i thought would be an easy thing, but is throwing me for a loop.
I have two DB queries, what i need to do is output the results of one query, and as it outputs, check the results of the second query to see if it matches the first, so i can check off a check box (or not).
<cfquery datasource="#dsn#" name="get_pg">
SELECT iid, pgid FROM issuespages WHERE iid = #url.iid#
<cfquery name="get_pages" datasource="#dsn#">
SELECT pgid, pg_name FROM pages WHERE active = 1 ORDER BY pg_name
What i want to do is output all results from Q2 as a list of checkboxes, and if the results of a record in Q2 matched in Q1, check the checkbox.
Below is some code that doesnt work.
<input type="checkbox" name="checkbox" value="#pgid#" <cfif get_pages.pgid EQ get_pg.pgid>checked</cfif> /></td>
I am giving thie Question a 500 point value as i needed to figure this out yesterday.