bluesauceuk
Programmer
Hey,
I have this error "General error: Column count doesn't match value count at row 1" I take this to mean I am trying to insert 4 columns into a 5 column table.. sort of thing..
I have in this orderitems table (this holds the items related to the order)
These are the columns.
id, orderid (the parent), productid, quantity, size.
any ideas?
Thanks
I have this error "General error: Column count doesn't match value count at row 1" I take this to mean I am trying to insert 4 columns into a 5 column table.. sort of thing..
I have in this orderitems table (this holds the items related to the order)
These are the columns.
id, orderid (the parent), productid, quantity, size.
Code:
<cftransaction>
<cflock timeout="30" name="addorder" type="exclusive">
<cfquery name="createorder" datasource="#application.dsn#" username="#application.dsnun#" password="#application.dsnpw#">
INSERT INTO orders (firstname, surname, email, newsletter, phone, address1, address2, address3, address4, postcode, subtotal, pandp, total)
VALUES ('#form.firstname#', '#form.surname#', '#form.email#', '#form.newsletter#', '#form.phone#', '#form.address1#', '#form.address2#', '#form.address3#', '#form.address4#', '#form.postcode#', #form.subtotal#, #form.pandp#, #form.total#)
</cfquery>
<cfquery name="getorderid" datasource="#application.dsn#" username="#application.dsnun#" password="#application.dsnpw#">
SELECT MAX(id) AS maxordernumber
FROM orders
WHERE email = '#form.email#'
</cfquery>
</cflock>
</cftransaction>
<!--- add the items --->
<cftransaction>
<cflock timeout="30" name="additems" type="exclusive">
<cfloop collection="#session.cart#" item="i">
<cfquery name="additems" datasource="#application.dsn#" username="#application.dsnun#" password="#application.dsnpw#">
INSERT INTO orderitems {orderid, productid, quantity, size}
#getorderid.maxordernumber#, #session.cart[i][1]#, #session.cart[i][4]#, '#session.cart[i][5]#'
</cfquery>
</cfloop>
</cflock>
</cftransaction>
any ideas?
Thanks