簡體   English   中英

使用php更新sql時出現SQL語法錯誤

[英]SQL syntax error while update sql with php

我有一個問題,我嘗試用我的PHP腳本更新一個mysql數據庫,但我成了消息:

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查詢中的反引號(`)中

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM