Jump to content

Server Error 500 Duplicate entry '' for key 'PRIMARY'


Reshkil

Recommended Posts

I am developing an application using Prestashop's webservices. Here is what has happened, making some scripts for the webservice I was checking data in different loops and had to change the max_execution_time in php ini from 30 to 900 (this was a dummy number just to see if it worked). Afterwards I couldn't make new orders using the webpage, I tried to do it on the database using phpmyadmin but I get the error 500 (I attached 2 screenshots of the error and the admin dashboard).

 

 

Does anyone have any idea what could be the problem? I can't make any new order because of the Duplicate entry '' for key 'PRIMARY' error. Isn't the primary key for the ps_orders table id_order which should be entered blank because of the auto increment attribute? 

 

Here is what i tried to do to troubleshoot the problem:


  • I did the same test with a new installation and it worked just fine. 
  • I tried to repair and optimize the ps_orders table and couldn't because it is a InnoDB type table.
  • I changed the table to MyISM, repaired it, optimized it and then turned it back to InnoDB. It didn't solve the problem.
  • I dropped the table and created it again, then I tried to insert new rows and had the same error.
If you have any information that can help me I will appreciate it.


 

Thank you,

post-892881-0-96645500-1420210346_thumb.jpg

post-892881-0-00817000-1420210348_thumb.jpg

Link to comment
Share on other sites

you are trying to insert a record whose primary key already exists.  The table in question is ps_orders, which has a primary key on the id_order column.

 

So you need to figure out why you are trying to add an order using the same id_order, they need to be unique

Link to comment
Share on other sites

Hi Bellini13,

 

The problem is that the duplicate entry comes as blank ''. The primary key for the ps_orders table is id and it is a autoincrement field, that is why the queries go blank with the id, so the database will set the id. Does anyone know why is it throwing the error with a blank id?

 

Thank you

Link to comment
Share on other sites

Hi Enrique,

 

I am using the normal webstore in PrestaShop and making the order as an end user to test why it is not working. On the developers error screen I only see 1 query, how can I know if it is firing more than once? I have the Firebug on my Firefox to check the network tasks and only 1 request is sent. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...