Wordpress Theme - Song Lyrics - Just Holden Commodores - Debt Consolidation - Internet Advertising

PDA

View Full Version : cfloop


mofufus
Sep 6th 2005, 10:05 am
hi guys,

please excuse my ignorance, but i've been having difficulties with the follow cfloop. here are the codes:

<cfquery name="GetRef" datasource="#BS#">
SELECT ref_id, first_name, last_name
FROM ref
</cfquery>
<cfquery name="GetRefOption" datasource="#BS#">
SELECT assign_ref_id, ar.ref_id, r.first_name, r.last_name
FROM assign_ref ar join ref r on r.ref_id = ar.ref_id
WHERE assign_id = #URL.assign_id#
ORDER BY ar.ref_id
</cfquery>
<cfloop query="GetRefOption">
<tr>
<cfoutput>
<td align="right"><b>Referee #GetRefOption.currentrow#:</b></td>
<td align="left">
<input type="hidden" value="#assign_ref_id#" name="assign_ref_id">#assign_ref_id#
<input type="hidden" value="#ref_id#" name="">#ref_id#
<select name="ref#GetRefOption.currentrow#">
<option value=""></option>
<cfloop query="GetRef">
<option value="#ref_id#" <cfif #GetRefOption.ref_id# eq #ref_id#>selected</cfif>>#first_name# <cfif last_name neq ' '>#last_name#</cfif></option>
</cfloop>
</select>
</cfoutput>
</td>
</tr>
</cfloop>

in the first cfloop, it was able to grab the data from pass the ref_id separately. but when i used the 2nd cfloop to select if ref_id = ref_id in the table, it only pass 1 ref_id which was the most current one. please help if anyone know if there's an easier when of passing the ref_id to make it select but i also have the hidden form to pass the parameter of other id.

thank you.

tbarr60
Sep 16th 2005, 8:48 pm
You could alias one of the ref_id's in your query.

Here's part of the query:

select ref_id as ref_id_option