我对 PDO 有问题,找不到解决方案:
我的功能:
public static function create($position, $name, $mail, $mailtext, $confirmed, $key, $formid) {
global $database;
try {
$pdo_result = $database->prepare('INSERT INTO Form (Position, Name, Mail, MailText, Confirmed, Key, Form_idForm) VALUES(:Position, :Name, :Mail, :MailText, :Confirmed, :Key, :Form_idForm)');
$pdo_result->execute(array(
':Position' => $position,
':Name' => $name,
':Mail' => $mail,
':MailText' => $mailtext,
':Confirmed' => $confirmed,
':Key' => $key,
':Form_idForm' => $formid
));
return $database->lastInsertId();
} catch(PDOException $e) {
Page::error('Error: Message:', $e->getMessage());
}
return null;
}
异常: SQLSTATE[42000]:语法错误或访问冲突:1064 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以获取在 'Key, Form_idForm) VALUES('Position', 'Name', 'Mail', 'MailText', '1', 'keeey', '' 附近使用的正确语法在第 1 行