“列计数与第1行的值计数不匹配". [英] "Column count doesn't match value count at row 1"
本文介绍了“列计数与第1行的值计数不匹配".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:
Mysql& PHP错误:列数与第1行的值数不符
Possible Duplicate:
Mysql & PHP Error: Column count doesn't match value count at row 1
我正在尝试用PHP创建一个帐户注册表格.我已经将其连接到我的MySQL数据库,但是在尝试使用表单进行注册后,出现标题中的错误.
I am trying to create an account registration form in PHP. I have connected it to my MySQL database, but after I try to sign up with the form I get the error that is in the title.
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())") ...
这篇关于“列计数与第1行的值计数不匹配".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文