I'm trying to loop a somewhat complicated (for me) piece of code instead of 
having to constantly it update manually. It seems like I should be able to use 
a loop but I can't figure it out. 

I have to write out variables whose only difference is based on numbering that 
just increases one unit at a time, like: mealID1Ordered, mealID2Ordered, 
mealID3Ordered, etc...but in the template I have to write these out as 
variables with the pound sign, so the code has to really be #mealID1Ordered#, 
#mealID2Ordered#, #mealID3Ordered#, etc....if I use a simple cfloop where 
index=z start=1 end=50, I can't insert the index variable inside the main 
variable...if this worked I'd be ok: #mealID#z#Ordered#... but of course CF 
interprets that as a line starting with a variable called #mealID#...

here's the actual slice of code I keep having to rewrite whenever the client 
wants to use a new item:

<cfif #session.mealID1Ordered# gt 0> 
        <CFQUERY DATASOURCE="#dsn#">
        INSERT INTO  mealsOrdered (quantityOrdered,
                                                        mealTypeID_FK,
                                                        OrderID_FK,
                                                        Calendar_ID_FK,
                                                        menuID_FK,
                                                        mealDateOrdered,
                                                        Signup_ID_FK)
        VALUES  ('#session.mealID1Ordered#',
                         '#session.servingType1#',
                         '#ordID#',
                         '#session.CID#', 
                         '1',
                         '#dateToday#',
                         '#session.SuID#')

</CFQUERY>
</cfif>

.....Any help in creating a workable loop would be fantastic!...thanks...

-John Petroshius

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:15:1426
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to