close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Duplicate entry '12' for key 'PRIMARY'

Thread began 9/15/2011 12:56 pm by sean366869 | Last modified 9/16/2011 1:33 pm by Jason Byrnes | 1800 views | 3 replies |

sean366869

Duplicate entry '12' for key 'PRIMARY'

Fairly new to the PHP language, but searched all the threads on this for ecart 4. I'm throwing this error at the confirmation page, but only when i have more than one item in the cart. Everything shows up nicely in the cart, but once we're past the login and to the confirmation screen, it throws the error. single items work just fine. The primary key(OrderID) is set to Autoincrement, i have dumped the whole DB and started from scratch, and still get the error. not sure why. Any help would be very much appreciated.

Sign in to reply to this post

Jason ByrnesWebAssist

this error would happen if you set the Store Order Summary or Store Order Details server behaviors to store a value to the primary key column of the either the orders or order details tables.

since it works if you only have one item, My guess is that you are storing the Order ID value to the DetailsID column of the of the OrderDetails table in the store order details behavior.


on the confirm page, open the Server Behaviors panel, and double click the Store Order Details behavior, make sure that the DetailID column is not set to receive a value.

Sign in to reply to this post

sean366869

Thanks.
I have started the checkout wizard again, just to make a clean install. i found 2 of the same server behaviors attached to the page. So, if i am storing an order summary in the db, which table should i be pulling the data from? I'm not sure where the fields are related between tables. I used the e commerce db kit for this, but i want to make sure i get this right so i don't have to keep bothering people. Thanks again.

Sign in to reply to this post

Jason ByrnesWebAssist

For the order summary, you will not be pulling information from a table, the order summary will use the information posted by the checkout form on the confirm page.

Sign in to reply to this post

info385026

7 years past to reply this thread?

Year 2013,
I was making a download centre and I struck with this problem "primary key duplicates".
I took auto-increment value out from 'orderdetailID' and record insertion is working perfectly.

Sign in to reply to this post

Jason ByrnesWebAssist

the last post in this thread was made on 09-16-2011 09:33 PM, that is not 7 years.

glad to hear you found the cause of the problem and fixed it by not storing a value in the auto increment ID field.

You should never force a value to the auto increment field, let the database manage that field for you.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...