MySQL database not wanting to add any new records
ok so I have this code
`$sql = "INSERT INTO userTable (username, password, gender, city, zip, email) VALUES ('$username', '$password', '$male', '$city', '$email')";
mysql_query($sql) or die ("unable to process query");`
and for some reason it works on my local server but not on the webserver, all the variables are set for sure. it gives me the unable to process query error,
am i doing something obv开发者_如何学Goiously wrong? thanks a lot
You're providing 6 parameters, but only 5 values in your insert statement.
try this
$sql = "INSERT INTO userTable (username, password, gender, city, zip, email) VALUES ('$username', '$password', '$male', '$city', '$zip', '$email')";
mysql_query($sql) or die ("unable to process query");
ScArcher seems to have found the correct answer, but you might also want to know about mysql_error. You can use this to print the error from the database, so next time you can perhaps solve the error yourself.
$gender
is missing
精彩评论