 <p>From your error message: <code>Duplicate entry '0' for key 'PRIMARY'</code></p> <p>I'm assuming id is your primary key. Make sure you have auto increment setup on this column and then just exclude the id field completely in the query.</p> <p>Right now your inserting a blank ID. Without strict enforcement, MySQL will convert an empty value to a 0 for an integer field. So you are trying to insert into ID 0 every time rather than creating a new row.</p> <p><strong>Dangers of your query</strong></p> <p>You are using unsanitized user input in your query (GET). GET, POST, REQUEST, and COOKIE variables should always be used with prepared queries.</p> <p>Right now I could load your url with something like <code>?name="'; DELETE FROM 49 WHERE 1;"</code> and wipe out your entire table. Research SQL injections and how to use MySQLi to make prepared queries.</p>