gpt4 book ai didi

php - “列计数与第1行的值计数不匹配”

转载 作者:行者123 更新时间:2023-12-01 00:13:27 24 4
gpt4 key购买 nike

Possible Duplicate:
Mysql & PHP Error: Column count doesn't match value count at row 1




我正在尝试在PHP中创建一个帐户注册表格。我已将其连接到我的MySQL数据库,但是在尝试使用表单进行注册后,出现标题中的错误。

if(isset ($_POST['submit']))
{
include( 'connection.php' );

$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];

if(empty($username) || empty($email) || empty($password))
{
echo 'Please check the required fields.';
}
elseif(!filter_var($email,FILTER_VALIDATE_EMAIL))
{
echo 'Please enter a correct email address.';
}
else
{
$password = md5($password);
$sql = mysql_query("INSERT INTO users (email,username,password) VALUES ('$email','$username','$password',now())") or die(mysql_error());

if($sql)
{
echo 'Successfully submitted.';
}
}
}

最佳答案

3栏:

$sql = mysql_query("INSERT INTO users (email,username,password)


4个值:

  VALUES ('$email','$username','$password',now())") ...

关于php - “列计数与第1行的值计数不匹配” ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11378568/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com