MySQL列计数与第1行的值计数不匹配

MySQL列计数与第1行的值计数不匹配

问题描述:

我正在尝试使用PHP将数据插入MySQL表中,但出现错误

I'm trying to insert data into a MySQL table using PHP, but getting the error

列数与第1行的值数不符

Column count doesn't match value count at row 1

mysql_query("INSERT INTO file (id, filename, extention, filelink, filesize, filepass) VALUES('{$random}', '{$filename}', '{$extension}', '{$filelink}', '{$filesize}' '{$filepass}') ") or die(mysql_error());

mysql_query("INSERT INTO file (id, filename, extention, filelink, filesize, filepass) VALUES('{$random}', '{$filename}', '{$extension}', '{$filelink}', '{$filesize}' '{$filepass}') ") or die(mysql_error());

您应该在{$ filesize}之后添加缺少的逗号:

You should add the missing comma after {$filesize}:

mysql_query("INSERT INTO file (id, filename, extention, filelink, filesize, filepass) VALUES('{$random}', '{$filename}', '{$extension}', '{$filelink}', '{$filesize}', '{$filepass}') ") or die(mysql_error());