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"

<cfquery datasource="MontPharmaData">
INSERT INTO Orders (UserName, CodeNo, DIN, BrandName, Manufacturer, GenericName,
"Size", Price, Qty, Extension) VALUES (
<cfif IsDefined("FORM.HFUsername"

'#FORM.HFUsername#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.HFCodeNo"

#FORM.HFCodeNo#
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.HFDIN"

'#FORM.HFDIN#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.HFBrandName"

'#FORM.HFBrandName#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.HFManufacturer"

'#FORM.HFManufacturer#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.HFGenericName"

'#FORM.HFGenericName#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.HFSize"

'#FORM.HFSize#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.HFPrice"

'#FORM.HFPrice#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.HFQty"

'#FORM.HFQty#'
<cfelse>
NULL
</cfif>
,
<cfif IsDefined("FORM.HFExtension"

'#FORM.HFExtension#'
<cfelse>
NULL
</cfif>
)
</cfquery>
</cfif>
pls. help
Jamal