开发者

MySQL database not wanting to add any new records

开发者 https://www.devze.com 2022-12-21 02:34 出处:网络
ok so I have this code `$sql = \"INSERT INTO userTable (username, password, gender, city, zip, email) VALUES (\'$username\', \'$password\', \'$male\', \'$city\', \'$email\')\";

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号