An error occurred trying to update the database Duplicate entry '1' for key 1
What does that mean?
it means you have a unique id identified, and there is already a row in the table with the column set to 1, and your script is wanting to put a 1 in a new row, but it won't let you