The error appears to complain that there is an attempt to add and si_invoice_items record with a duplicate value of 0 for its primary key. The primary key is (should be) the ID field. This field could only be assigned 0 if it does not have the auto increment setting on. User phpMyAdmin to verify this. There are two issues to correct. One is that there is now a record in that table with a 0 value for its ID field. That is a problem. I suggest you find which invoice this is for and delete it. If you don’t find a record with a 0 ID value, it was probably created for the invoice you are adding, say for the first invoice item and then it got an error on the second. Once you’ve cleared up the 0 ID issue, you can set the auto increment setting on the table. This can be done in phpMyAdmin. If you had to delete and invoice, add it back now. Make note of the original invoice number to reference it to the new number assigned to it for your records. Once you’ve taken care of any deleted invoice, you can add the invoice you were trying to add when this error occurred. All should be OK at this point.