SQL语法错误,同时用php更新sql
我有一个问题,我尝试更新一个MySQL数据库与我的PHP脚本,但我成为消息:
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 'mod = 3, drehtage = 4, schnitttage = 5, dreh = 0, schnitt = 0, off = 0, leiter =' at line 1
我希望你能帮助我,这里是我的代码来更新数据库(我只是编辑用户+传递;))
$con = mysql_connect('localhost', 'user', 'pass'); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("kup_projekte", $con); $aendern = "UPDATE drehs SET name = '".$t1."', drehdatum = '".$t2."', schnittdatum = '".$t3."', kamera = '".$t4."', assi = '".$t5."', mod = '".$t6."', drehtage = '".$t7."', schnitttage = '".$t8."', dreh = '".$t9."', schnitt = '".$t10."', off = '".$t11."', leiter = '".$t12."' Where id = '".$id."'"; $update=mysql_query($aendern); mysql_close($con);
//编辑//
变量$ t1 - $ t12被填充并正确显示。
mod是一个mysql保留字。 如果你想用它作为列名,你必须把它用反引号(`)放在你的SQL查询中
链接地址: http://www.djcxy.com/p/69523.html