I just tried everything I could, but nothing works. I think the code is self-explanatory:
$username = "stringvalue1";
$password = "stringvalue2";
$query = "INSERT INTO users (username, password)
VALUES ('$username', '$password')";
mysql_query($query);
It seems alrigth for me, but always returns “Duplicate entry ‘0’ for key ‘username'”, that’s because the username is an UNIQUE row, and there is a 0 value stored yet. The point is, I’m not trying to store any ‘0’, do you have any idea?
Thank you in advance (Y)
And sorry for any mistakes, I’m brazilian.
Quote your variables properly in query. Also check table structure and columns
data-typeand default values. Yourusernamecolumn may have an integer type.