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

时间:2018-06-24 14:00:11

标签: php mysql mysqli

在使用PHP + MySQL进行表单提交时出现此错误

Error: INSERT INTO artikel VALUES ('aa', 'aa', '2018-06-24')
Column count doesn't match value count at row 1

发件人:

<form method="post" name="posting_form" action="submit.php">
Judul Artikel<br>
<input type="text" name="judul_artikel" size="30"><br>
Isi Artikel<br>
<textarea name="isi_artikel" cols="60" rows="10"></textarea><br>
<input type="submit" name="submit" value="submit artikel">
</form>
$judul = $_POST['judul_artikel'];
$isi = $_POST['isi_artikel'];
$tgl = date('Y-m-d');
$sql = "INSERT INTO artikel VALUES ($judul, $isi)";
if ($koneksi->query($sql) === TRUE) {
    echo "New record created successfully";
} else {
    echo "Error: " . $sql . "<br>" . $koneksi->error;
}
?>

错误是什么意思?

0 个答案:

没有答案