错误:您的SQL语法出错;查看与您的MySQL服务器版本对应的手册,以便在第1行的“1”附近使用正确的语法。代码如下所示我得到错误,这是从http://cms2.br-de.tk/editinfo.php到{{3} }
<?php
mysql_connect("mysql10.000webhost.com","******_12","*******") or die("Error:".mysql_error());
mysql_select_db("******_1");//add your dbname
//get the variables we transmitted from the form
$Title = $_POST['Title'];
$Author = $_POST['Author'];
$Date = $_POST['Date'];
$Content = $_POST['Content'];
//replace TestTable with the name of your table
//replace id with the ID of your user
$sql = "UPDATE `posts` SET `Tilte` = '$Tilte',`Author` = '$Author',`Date` = '$Date',`Content` = '$Content' WHERE `posts`.`ID` = '$ID' 1 ";
mysql_query($sql) or die ("Error: ".mysql_error());
echo "Database updated. <a href='editinfo.php'>Return to edit info</a>";
?>
答案 0 :(得分:1)
您在查询结尾处添加了额外的1。它应该是这样的:
$sql = "UPDATE `posts` SET `Tilte` = '$Title',`Author` = '$Author',`Date` = '$Date',`Content` = '$Content' WHERE `posts`.`ID` = '$ID'";
答案 1 :(得分:0)
您的陈述结尾处有一个备用1
。
UPDATE `posts` SET `Tilte` = '$Title',`Author` = '$Author',`Date` = '$Date',`Content` = '$Content' WHERE `posts`.`ID` = '$ID';"
正如Grigore正确发现的那样,根据您的列名,您的语句中也可能会出现拼写错误。
UPDATE `posts` SET `Title` = '$Title',`Author` = '$Author',`Date` = '$Date',`Content` = '$Content' WHERE `posts`.`ID` = '$ID';"
答案 2 :(得分:0)
`Tilte` = '$Title'
也许这是标题而不是倾斜,除了在查询结尾处有一个“1”