ITCOOKBOOK.com

 Options

Current Time:
Thu Sep 09, 2010 10:39 am
View unanswered posts

Log in

Username:
Password:
Log me on automatically each visit

Topic Information

cfloop help

 
Post new topic   Reply to topic    ITCOOKBOOK.com Forum Index -> ColdFusion MX7
View previous topic :: View next topic  
Author Message
Silver79
Fresher


Joined: 02 Dec 2006
Posts: 11
Location: Detroit, MI

PostPosted: Sun Dec 03, 2006 10:35 pm    Post subject: cfloop help Reply with quote

I would like to display all the programs in a select box and only select the ones that are coming from the database (the user's saved programs).

Code:
<cfquery>
SELECT F.ID, F.First_Name, F.Last_Name, F.a, F.b, F.c, F.d
FROM Table1 F
WHERE F.Id = <cfqueryparam>
</cfquery>

<form>
<cfoutput>










<p>First Name*<br><input></p>
<p>Last Name*<br><input></p>
...
MORE FIELDS
...







<cfquery>

SELECT FATP.table2ID, FATP.ProgramID as FATPPID, t3.Name as t3Name
FROM table2 FATP INNER JOIN table3 t3 ON FATP.ProgramID = t3.ProgramID
WHERE FATP.table2ID = #URL.myID#
</cfquery>

<cfquery>
SELECT ProgramID, Name FROM table3
</cfquery>

<select>
<option>Please Select</option> <cfloop>
<option value="#ProgramID#" <cfif>selected</cfif>>#Name#</option>
</cfloop>
</select>



</cfoutput>
</form>

How can I correct this looping problem?
Back to top
View user's profile Send private message
cindy
Member


Joined: 02 Dec 2006
Posts: 22

PostPosted: Sun Dec 03, 2006 10:35 pm    Post subject: Reply with quote

Create a list of all programid's from query2 and then do a listfind on that list against the query3's programid.

EX Code:
<cfquery>
SELECT FATP.table2ID, FATP.ProgramID as FATPPID, t3.Name as t3Name
FROM table2 FATP INNER JOIN table3 t3 ON FATP.ProgramID = t3.ProgramID
WHERE FATP.table2ID = #URL.myID#
</cfquery>
<cfset>

<cfquery>
SELECT ProgramID, Name FROM table3
</cfquery>

<select>
<option>Please Select</option>
<cfloop>
<option value="#ProgramID#" <cfif>selected</cfif>>#Name#</option>
</cfloop>
</select>
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ITCOOKBOOK.com Forum Index -> ColdFusion MX7 All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Help US Help YOU

 

 

Please complete our short survey and save $17.50 on ITCOOKBOOK.COM.

 

 

Take a look at SAPTrends.com, a new blog dedicated to discussion of SAP Training trends in SAP ERP.

 

 

C# Interview Questions

 

.NET Interview Questions

 

Java Interview Questions

 

Python Interview Questions

 

ColdFusion Interview Questions

 

Linux Interview Questions

 

Linux LPIC 1 Certification Questions

 

Perl Programming Interview Questions