MySQL数据库不想添加任何新记录

Dou*_*eux 2 php mysql database records

好的,所以我有这个代码

`$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");`
Run Code Online (Sandbox Code Playgroud)

由于某种原因,它可以在我的本地服务器上运行,但不能在Web服务器上运行,所有变量都是可靠的.它让我无法处理查询错误,

我做的事情显然是错的吗?非常感谢

ScA*_*er2 6

您提供了6个参数,但在insert语句中只提供了5个值.

试试这个

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

  • 有时它只需要另一组眼睛. (3认同)