我目前正在跟隨PHP的教程,和我有下面的代碼::PHP SQL INSERT語句返回語法錯誤,不知道它可能是
$sql = "insert into practice (title, synopsis, genre, release, score, poster)
values('{$title}','{$synopsis}','{$genre}','{$release}','{$score}','{$poster}')";
if ($result = $mysqli->query($sql)) {
// movie successfully added
// redirect to index.php
header("Location: index.html");
exit;
}
elseif ($mysqli->connect_errno) {
// there was a database error when inserting
printf("Insert failed: %s\n", $mysqli->error);
}
else {
printf("Sorry this isn't working! Insert failed: %s\n", $mysqli->error);
}
目前我得到了什麼錯誤,指出「對不起,這是行不通的。」和mysqli錯誤只是說:
You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right syntax
to use near 'release, score, poster) values ('fa','f','ff','ff','ff','ff')' at line 1.
我是一個完整的新手,所以我有點在什麼樣的語法錯誤,實際上可能失去條款。感謝提前
顯示使用db結構的數據庫表結構 – sree 2012-08-03 15:07:38
不應該導致語法錯誤... – bioneuralnet 2012-08-03 15:09:32