dongshi1914 2013-12-31 08:59
浏览 71
已采纳

我有一个错误:检查与您的MySQL服务器对应的手册

I keep getting the error:

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 'WHERE order_id = 100038' at line 1

upper part of my code where the problem should be:

$id     = $_GET["Ref"];
    $state  = 'Geannuleerd';
    if (!empty($id)){

        $con= mysqli_connect("**********","************","**************","**************");

        if (mysqli_connect_errno()) {
        printf("Connect failed: %s
", mysqli_connect_error());
        exit();
        }   

        $updquery = "UPDATE order SET order_state = '$state', WHERE order_id = $id";

        $updresult = mysqli_query($con, $updquery);
        if (!$updresult) {
        printf("error: %s
", mysqli_error($con));
        }

        mysqli_free_result($updresult);

        $mailquery = "SELECT * FROM order WHERE order_id ='". $id. "'";

        $mailresult = mysqli_query($con, $mailquery);
        if (!$mailresult) {
        printf("error: %s
", mysqli_error($con));
        }

Like i see it is the UPDATE statement that has a wrong syntax. The SELECT works perfectly!

Thanks for the help!

  • 写回答

1条回答 默认 最新

  • dongren4758 2013-12-31 09:01
    关注

    Remove comma before WHERE statement.

    $updquery = "UPDATE order SET order_state = '$state' WHERE order_id = $id";

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

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器