duan41497 2014-08-29 08:06
浏览 48
已采纳

预准备语句上的语法错误

I have this query

$q1 = "UPDATE klanten SET (
       kla_tel2,
       kla_mobiel,
       kla_fax,
       kla_btw_nummer,
       kla_bankrekening,
       kla_ww,
       kla_bez_straat,
       kla_bez_nummer,
       kla_bez_toev,
       kla_bez_pc,
       kla_bez_plaats,
       kla_bez_land_id,
       kla_post_straat,
       kla_post_nummer,
       kla_post_toev,
       kla_post_postbus,
       kla_post_pc,
       kla_post_plaats,
       kla_post_land_id,
       kla_fac_straat,
       kla_fac_nummer,
       kla_fac_toev,
       kla_fac_postbus
       kla_fac_pc,
       kla_fac_plaats,
       kla_fac_land_id,
       kla_sidn_owner,
       kla_reg_status,
       kla_rechtspersoon
       )
       VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
       WHERE kla_id=" . $kla_id;

But when executed it gives me a syntax error 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 '( kla_tel2, kla_mobiel, kla_fax, kla_btw_num' at line 1: SQL: UPDATE klanten SET ...

What I know is that all values are filled and that $kla_id is filled too, but as this is a SQL Syntax error that shouldn't be a problem.

EDIT

MySql Client Version is 5.0.51a Server Version is 5.0.51a-24+lenny4 Protocol version is 10

  • 写回答

1条回答 默认 最新

  • dongzhang0418 2014-08-29 08:10
    关注

    You're using the wrong UPDATE syntax. Please see the docs for more info.

    The right syntax looks like:

    UPDATE klanten SET kla_tel2 = <some_value>, kla_mobiel = <some_other_value> WHERE kla_id = <some_third_value>
    

    You can also use this with prepared SQL statements like your example above, using question marks.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端