A primary key is a unique identifier for each row that is entered into the database. If you are getting that error is means you are attempting to add a new row into the database with a primary key that already exists.
Well you had to make some changes to the script to get this error so I'm wondering what your primary key is set as now. Traditionally primary keys default as NULL and auto increment (meaning your key will be a number, the first rows key will be 0 and it will automatically add an increment one 1 for each additional entry), so its rare to receive this problem so I'm guessing you changed your primary key at some point.
Also I would check the line of code that adds a new row to the database. That line could hold a clue to solving your problems.
Well you had to make some changes to the script to get this error so I'm wondering what your primary key is set as now. Traditionally primary keys default as NULL and auto increment (meaning your key will be a number, the first rows key will be 0 and it will automatically add an increment one 1 for each additional entry), so its rare to receive this problem so I'm guessing you changed your primary key at some point.
Also I would check the line of code that adds a new row to the database. That line could hold a clue to solving your problems.