Search code examples
phpmysqldatabaserecords

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


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