Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么可以';t处理这个查询?(mysql、php)_Php_Mysql - Fatal编程技术网

为什么可以';t处理这个查询?(mysql、php)

为什么可以';t处理这个查询?(mysql、php),php,mysql,Php,Mysql,我在使用mysql时遇到了一些问题。我完全不知道 问题是 $sql = "insert into Write_Member_Comment(writer, passwd, commentID) values('test', '$passwd' '$commentID')"; mysql_query($sql, $connect); echo mysql_error(); 我临时填写了writer“test”(最初是“$writer”),但结果是 'C

我在使用mysql时遇到了一些问题。我完全不知道

问题是

$sql = "insert into Write_Member_Comment(writer, passwd, commentID)
                    values('test', '$passwd' '$commentID')";


mysql_query($sql, $connect);
echo mysql_error();
我临时填写了writer“test”(最初是“$writer”),但结果是

'Column count doesn't match value count at row 1'
这是我的Write_Member_评论表

create table Write_Member_Comment(
writer      char(30) not null,
passwd      char(30) not null,
commentID   int not null,
FOREIGN KEY (commentID) REFERENCES PostComment(commentID) ON DELETE CASCADE ON UPDATE CASCADE) engine=InnoDB character set=utf8;

为什么不工作?

您缺少一个逗号,应该是:

$sql = "insert into Write_Member_Comment(writer, passwd, commentID)
                values('test', '$passwd', '$commentID')";

最后两个值之间缺少逗号。此问题似乎与主题无关,因为它涉及语法错误哦。。。!我真傻。对不起,谢谢!我得买眼镜了!