Question

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 obviously wrong? thanks a lot

Was it helpful?

Solution

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");

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top