0
這個SQL查詢有什麼問題?mySQL語法錯誤
if(isset($_POST['submit'])){
$name = $_POST['name'];
$author = $_POST['author'];
$pub = $_POST['pub'];
$sibn = $_POST['sibn'];
$year = $_POST['year'];
$version = $_POST['version'];
$desc = $_POST['desc'];
$selected_db = mysql_select_db("bookstore",$con);
$query = "INSERT INTO introducebook (name, author, pub, sibn, year, version, desc) VALUES ('{$name}', '{$author}', '{$pub}', '{$sibn}', {$year}, {$version}, '{$desc}');" ;
$result = mysql_query($query,$con);
if(!$result){die('could not perform query'.mysql_error());}
echo mysql_affected_rows();
}
?>
錯誤的是(我通過所有輸入測試):
你在你的SQL語法錯誤;檢查與您的MySQL服務器版本相對應的手冊,以便在第1行的'desc'VALUES('test','test','test','test',test,test''test')'附近使用正確的語法
是的,這是正確的...非常感謝你... –