简体   繁体   English

PHP SQL UPDATE查询问题

[英]PHP SQL UPDATE Query issue

I'm having trouble with this update query.INSERT works absolutely fine.My INSERT query and UPDATE query as follows, 我在使用此更新查询时遇到问题。INSERT可以正常工作。我的INSERT查询和UPDATE查询如下所示,

This is the error that i've been getting. 这是我一直得到的错误。

db_exec:DB Error: 
 (UPDATE vms2 set invoiceid='', slicenseinfo='testVM',  
   manufacturerid='692', hyp='6', stitle='UBER', vmg='UBER', sversion='1716',  sinfo='', 
   purchdate='1367712000', licqty='7', lictype='192', dns='', ipv4='10.2.36.3', ipv4dns='102.32.3.55', 
    remip='110.2.3.3', remipdns='100.32.3.32', ipv6='', 
    hdd='', ram='', cores='',  WHERE id=14): 
    near "WHERE": syntax error


Array
(
    [0] => Array
        (
            [file] => C:\xampp\htdocs\test\php\editvm.php
            [line] => 149
            [function] => db_exec
            [args] => Array
                (
                    [0] => PDO Object
                        (
                        )

                    [1] => UPDATE vms2 set invoiceid='', slicenseinfo='testVM',  manufacturerid='692', hyp='6', stitle='UBER', vmg='UBER', sversion='1716',  sinfo='', purchdate='1367712000', licqty='7', lictype='192', dns='', ipv4='10.2.36.3', ipv4dns='102.32.3.55', remip='110.2.3.3', remipdns='100.32.3.32', ipv6='', hdd='', ram='', cores='',  WHERE id=14
                )

        )

    [1] => Array
        (
            [file] => C:\xampp\htdocs\test\index.php
            [line] => 490
            [args] => Array
                (
                    [0] => C:\xampp\htdocs\test\php\editvm.php
                )

            [function] => require
        )

)

Thanks for your help :) 谢谢你的帮助 :)

删除WHERE之前的最后一个逗号

You have an extra comma before the Where clause which is not required 在Where子句之前,您有一个多余的逗号

UPDATE vms2 set invoiceid='', slicenseinfo='testVM',  manufacturerid='692', hyp='6', stitle='UBER', vmg='UBER', sversion='1716',  sinfo='', purchdate='1367712000', licqty='7', lictype='192', dns='', ipv4='10.2.36.3', ipv4dns='102.32.3.55', remip='110.2.3.3', remipdns='100.32.3.32', ipv6='', hdd='', ram='', cores=''  WHERE id=14

This should work. 这应该工作。

UPDATE命令更新为此

 UPDATE vms2 set invoiceid='', slicenseinfo='testVM',  manufacturerid='692', hyp='6', stitle='UBER', vmg='UBER', sversion='1716',  sinfo='', purchdate='1367712000', licqty='7', lictype='192', dns='', ipv4='10.2.36.3', ipv4dns='102.32.3.55', remip='110.2.3.3', remipdns='100.32.3.32', ipv6='', hdd='', ram='', cores=''  WHERE id=14`

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM