致命错误:未捕获异常 'PDOException' 并带有消息 'SQLSTATE[42000]:语法错误或访问冲突:1064 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在 /home/ /domains/ /public_html/new/ .php:140的“第 1 行”附近使用正确的语法堆栈跟踪:#0 /home/ /domains/ /public_html/new/ .php(140): PDOStatement->execute() #1 {main} 在 /home/ /domains/ /public_html/new/***.php 第 140 行抛出
您可以在下面找到我的代码:
if(count($errors) == 0) {
$title = trim($_POST['title']);
$category = trim($_POST['category']);
$ing = trim($_POST['ing']);
$ing_pond = trim($_POST['ing_pond']);
$ing_note = trim($_POST['ing_note']);
$description = trim($_POST['description']);
$time = trim($_POST['time']);
$insert = $dbh->prepare('INSERT INTO recettes (id, id_user, title, category, ing, ing_pond, ing_note, description, graad, time) VALUES (NULL, :meid :title, :category, :ing, :ing_pond, :ing_note, :description, :graad, :time');
$insert->bindParam(':meid', $me['id'], PDO::PARAM_INT);
$insert->bindParam(':title', $title, PDO::PARAM_STR);
$insert->bindParam(':category', $category, PDO::PARAM_STR);
$insert->bindParam(':ing', $ing, PDO::PARAM_STR);
$insert->bindParam(':ing_pond', $ing_pond, PDO::PARAM_STR);
$insert->bindParam(':ing_note', $ing_note, PDO::PARAM_STR);
$insert->bindParam(':description', $description, PDO::PARAM_STR);
$insert->bindParam(':graad', $graad, PDO::PARAM_STR);
$insert->bindParam(':time', $time, PDO::PARAM_STR);
$insert->execute();
$uid = $dbh->lastInsertId();
echo alert('Uw gerecht is succesvol toegevoegd.', 'success');
$added = true;
}else{
echo alert('Er ging wat mis. De volgende dingen gingen fout:<ul><li>' . join('</li><li>', $errors) . '</li></ul>Het gerecht is helaas niet toegevoegd.', 'danger');
}
我该如何解决这个问题,请帮助我:-)
非常感谢!