I'm using this code to insert some stuff into my table..

$createUser = "INSERT INTO users (username,password,email,website) VALUES ('$username','$password','$email','$website')";
$cu = mysql_query($createUser)or die(mysql_error());

and i get this error

Duplicate entry '0' for key 1

i have an id column set up to AUTO_INCREMENT, so it should be trying to create multiple entries with teh same id.. but i dunno whats going on! thanks

    You need to set it up as a Primary Key also double check its a numeric type and is set to auto_increment although you did say it was normally it wouldnt allow it if its not a Primary Key

      to expand on what planetsim said:

      id INT NOT NULL AUTO_INCREMENT PRIMARY KEY

      Try something like that.

        i thought i had it set up like that, but i guess i forget to set AUTO_INCREMENT.. damn phpMyAdmin.. thanks guys

          Write a Reply...