Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Getting Started / October 2004



Tip: Looking for answers? Try searching our database.

Update table with array values?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
adventuregirl - 27 Oct 2004 14:23 GMT
If I have an array, and I want to update a table with those values, How do I
keep the sequence in order?  I'm in a loop to create the array, and am trying
to update the table after the array is complete?
<cfscript>
    stDownPaymentInfo = StructNew();
    stMyDownpayments = StructNew();
    stMyDownpayments.aDownpayments = ArrayNew(1);
    stDownpaymentInfo.aDownPayments = ArrayNew(1);
</cfscript>
 <cfloop index="I"
    FROM="1"
    TO="#control_suspenseCount#">
<cfscript>
       
        stDownPaymentInfo.AgentState = '#DisplayAgentState#';
        stDownPaymentInfo.RegOffice = '#DisplayREgionalOffice#';
        stDownPaymentInfo.AgentNumber = '#DisplayAgentNumber#';
        stDownPaymentInfo.SuspenseNumber = '#DisplaySuspenseNumber#';
        stDownPaymentInfo.Company = '#DisplayCompany#';
        stDownPaymentInfo.Policy = '#DisplayPolicyNum#';
        stDownPaymentInfo.Amount = '#DisplayAmount#';
        ArrayAppend(stMyDownpayments.aDownpayments,StructCopy(stDownpaymentInfo));
             
               
</cfscript>
</cfloop>
Update table here with values in above array .
Thanks
NateNielsen - 27 Oct 2004 14:58 GMT
<cfloop from="1" to="#arrayLen(stMyDownpayments.aDownpayments)#" index="i">
    <cfquery datasource="#yourDSN#" name="updatePaymentInfo">
        ...your query here...
        to get the value of an element, you'll use the following syntax :
        #stMyDownpayments.aDownpayments.AgentState#
        #stMyDownpayments.aDownpayments.RegOffice#
        #stMyDownpayments.aDownpayments.SuspenseNumber#
        ...etc.
    </cfquery>
</cfloop>

make sense ?
  =)

Nate Nielsen
http://www.webclarity.com
adventuregirl - 27 Oct 2004 16:32 GMT
Exellent - I was on the right track but missed one major issue.

Thanks a million!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.