Web Analytics Made Easy -
StatCounter Loop multidimentional array in cfc cffunction to insert into SQL - CodingForum

Announcement

Collapse
No announcement yet.

Loop multidimentional array in cfc cffunction to insert into SQL

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Loop multidimentional array in cfc cffunction to insert into SQL

    This works…
    Code:
    $.ajax({url: '../cfc/saveData.cfc', data: {method: 'addAccountInfo', acctNo: aID, firstName: firstName, lastName: astName, address1: address1, address2: address2, phone1: phone1, phone2: phone2, rowID:i}, success: function(data){return true;}});
    my cffunction in cfc...
    Code:
     <cffunction name = "addAccountInfo" access="remote" returntype="any" returnformat="plain">
            <cfargument name = "acctNo" required="yes" type="numeric">
            <cfargument name = "firstName" required="yes" type="string">
            <cfargument name = "lastName" required="yes" type="string">
            <cfargument name = "address1" required="yes" type="string">
            <cfargument name = "address2" required="yes" type="string">
            <cfargument name = "phone1" required="yes" type="string">
            <cfargument name = "phone2" required="yes" type="string">
            <cfargument name = "rowID" required="yes" type="numeric">
                 <cfquery name="addInfo">
                        INSERT INTO acctInfo
                                             (acctNo,
                                              firstName,
                                              lastName,
                                              address1,
                                              address2,
                                              phone1,
                                              phone2,
                                               rowID)
                                  VALUES (<cfqueryparam cfsqltype="cf_sql_numeric" value="#aID#">,
                                          <cfqueryparam cfsqltype="cf_sql_varchar" value="#firstName#">,
                                          <cfqueryparam cfsqltype="cf_sql_varchar" value="#lastName#">,
                                          <cfqueryparam cfsqltype="cf_sql_varchar" value="#address1#">,
                                          <cfqueryparam cfsqltype="cf_sql_varchar" value="#address2#">,
                                          <cfqueryparam cfsqltype="cf_sql_varchar" value="#phone1#">,
                                          <cfqueryparam cfsqltype="cf_sql_varchar" value="#phone2#">,
                                          <cfqueryparam cfsqltype="cf_sql_numeric" value="#i#">)
                 </cfquery>
    </cffunction>
    But now, I've placed the data in an array called fldData and I've passed the array to the cffunction in the cfc using...
    Code:
    $.ajax({url: '../cfc/savaData.cfc?method=addAccountInfo', data: fldData, success: function(data){return true;}});
    Now the insert doesn't work. Nothing inserts. No errors. I used console.log and the data is there in an array. I've tried many suggestions but nothing works so far, so I figured maybe I needed to ask my own question.
    Any assistance would be greatly appreciated.
Working...
X