close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Duplicate entry '29' for key 'PRIMARY'

Thread began 6/06/2014 10:54 pm by rgolab68503 | Last modified 6/11/2014 10:59 am by Jason Byrnes | 1747 views | 7 replies |

rgolab68503

Duplicate entry '29' for key 'PRIMARY'

Hi Jason,

I thought I would put this under a new thread although I still have a few other questions.

Now if I go through the checkout process if I have one item in the cart the only issue is the email not getting through. However if I have more than one item in the cart I get an error "Duplicate entry '29' for key 'PRIMARY'"

Now I have look through several threads I have confirmed that the ID columns are "int" and set to auto increment. I think I just about exhausted all teh other suggestions. Do you have any ideas as to why this is now happened?

I should mention that this wasn't happening before we did our session. However another issue popped up that wasn't happening before probably because I chose a different product for the test. This one had a SKU which is not just numbers as many of my clients products have. I went into eStore Details Database and changed "DetailProdID" to text. This fixed the issue of accepting the "mixed" product code or SKU.

But then I tried a test with multiple items and the Duplicate entry '29' for key 'PRIMARY' started showing up. Any ideas on this one?

I added some clips from the database. please let me know if you need anything else.

Sign in to reply to this post

Jason ByrnesWebAssist

in the store order summary behavior, you are saving the Item ID value to the OrderID Column of the orders table.

the orderID column of the orders table is the primary key column. You should not assign a value to the primary key column, you should let the database populate that column automatically. let the database create a unique ID for each record rather than trying to force a value. the error is happening because you are forcing a value to the orderID column which is set to not allow duplicate values.

Sign in to reply to this post

rgolab68503

Hi Jason,

The only place I can see the cart trying to write anything to the OrderID column is in the store Cart Summary in Database screen. Are you saying that I should remove that line ... <?php echo $dtelecart->DisplayInfo("ID"); ?>

The only other place I can see it when it looks to be pulling that info from the Orders table and copying it to the orderdetails table ... <?php echo ((isset($_SESSION["dtelecart_OrderID"]))?$_SESSION["dtelecart_OrderID"]:""); ?>

Could I have added it someplace else as well?

Sign in to reply to this post

Jason ByrnesWebAssist

Originally Said By: rgolab68503
  Hi Jason,

The only place I can see the cart trying to write anything to the OrderID column is in the store Cart Summary in Database screen. Are you saying that I should remove that line ... <?php echo $dtelecart->DisplayInfo("ID"); ?>  



Yes, exactly.

In the store order summary behavior you should not be saving any value to the OrderID column which is the primary key column for that table. leave that column unbound.

Sign in to reply to this post

rgolab68503

Hi Jason,

So I believe I have cleared anything writing to the OrderID column. There should be nothing writing to it but i still get a - Duplicate entry '29' for key 'PRIMARY' when I try to add more than one product to the cart. It should be working now shouldn't it?

Are you sure it's the "Orders" table that is causing the error? Not the Order Details? That is where it seems to be trying to write the individual detail lines of an order and crashing.

Thanks for helping on this one. Just need to get this one last part working.Cheers!

Sign in to reply to this post

Jason ByrnesWebAssist

In the store order details behavior, you have the DetailID column bound to the Order ID Session, again, this column is the Primary key column for that table and should not have a binding.

Sign in to reply to this post

rgolab68503

Yes, I had removed that before and it didn't make a difference. I have it working now but it was not just the session in the OrderDetials.

What was throwing everything off was the for some reason the DetailOrderID column was set as auto increment and the primary key. I changed DetailID to be auto increment and the primary. Somehow when creating the cart I must have chosen this column as the key column when ecart created the table.

Looks to be working, hope everything goes smoothly now. Thanks for you help!

Sign in to reply to this post

Jason ByrnesWebAssist

Glad to hear it is working.

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...