Forums

This topic is locked

Insert Multiple records into one table

Posted 29 Jun 2004 03:31:01
1
has voted
29 Jun 2004 03:31:01 Ammar Jamal posted:
hi all
II really need help, I am new to CF what I am trying to do is the following:

I have a table in a form and I am trying to insert multiple data in a table .
I created an insert record but the problem that when I click the submit it inserts only the firs row of the table and that’s it .

Pls keep in mind that the number of rows is variable
This is the code I have:


<cfif IsDefined("FORM.MM_InsertRecord" AND FORM.MM_InsertRecord EQ "InsertOrder">
<cfquery datasource="MontPharmaData">
INSERT INTO Orders (UserName, CodeNo, DIN, BrandName, Manufacturer, GenericName,
"Size", Price, Qty, Extension) VALUES (
<cfif IsDefined("FORM.HFUsername" AND #FORM.HFUsername# NEQ "">
'#FORM.HFUsername#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.HFCodeNo" AND #FORM.HFCodeNo# NEQ "">
#FORM.HFCodeNo#
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.HFDIN" AND #FORM.HFDIN# NEQ "">
'#FORM.HFDIN#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.HFBrandName" AND #FORM.HFBrandName# NEQ "">
'#FORM.HFBrandName#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.HFManufacturer" AND #FORM.HFManufacturer# NEQ "">
'#FORM.HFManufacturer#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.HFGenericName" AND #FORM.HFGenericName# NEQ "">
'#FORM.HFGenericName#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.HFSize" AND #FORM.HFSize# NEQ "">
'#FORM.HFSize#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.HFPrice" AND #FORM.HFPrice# NEQ "">
'#FORM.HFPrice#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.HFQty" AND #FORM.HFQty# NEQ "">
'#FORM.HFQty#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.HFExtension" AND #FORM.HFExtension# NEQ "">
'#FORM.HFExtension#'
<cfelse>
NULL
</cfif>
)
</cfquery>
</cfif>

pls. help

Jamal

Reply to this topic