francis Aneke Posted March 26, 2014 Share Posted March 26, 2014 line23:Duplicate entry '1' for key 1 This is the line of code that has the error----> $sql=mysql_query("INSERT INTO forum_answer(question_id, a_id, a_name, a_email, a_answer, a_datetime) VALUES('$id','$max_id','$a_name','$a_email','$a_answer','$datetime')") or die('line'.__LINE__.':'.mysql_error()); Link to comment Share on other sites More sharing options...
justsomeguy Posted March 26, 2014 Share Posted March 26, 2014 Your database table has either a unique or primary key defined, and you're trying to insert a record with a value for that key that is already in the table. Primary and unique keys mean that every record in the table needs a different value for that column. Link to comment Share on other sites More sharing options...
francis Aneke Posted March 27, 2014 Author Share Posted March 27, 2014 @justsomeguy, I have SOLVED ii and its fine now--- Its just that am trying to insert values in an AUTO-INCREMENT PRIMARY KEY record Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now