Mysqli Error: Column count doesn't match value

2019-07-27 05:51发布

Below is the mysqli query that is being performed, anyone know what I get such error:

$sql = mysqli_query($db, "INSERT INTO `tbl_bugzilla` 
    (`id`, `by`, `title`, `content`, `date`, `application`,`priority`, `assigned`, `status`) 
    VALUES (NULL, '".$_SESSION['exp_user']['username']."', '"
        .$_SESSION['exp_user']['username']."', '".$title."', '".$content."','"
        .$dt."', '".$_POST['app']."', '".$_POST['priority']."', 'Unassigned', 'Unconfirmed')");

Error: Column count doesn't match value count at row 1

More importantly, could you explain the error so I don't make the same mistake again?

Thanks

标签: php mysqli
1条回答
我命由我不由天
2楼-- · 2019-07-27 06:12

Got the darn thing:

I mentioned '".$_SESSION['exp_user']['username']."', twice in the query, leading to 10 columns, not 9.

Sorry folks :(

查看更多
登录 后发表回答