1

我在使用此更新查询时遇到问题。INSERT 工作得非常好。我的 INSERT 查询和 UPDATE 查询如下,

这是我遇到的错误。

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
        )

)

谢谢你的帮助 :)

4

3 回答 3

1

去掉前面的最后一个逗号WHERE

于 2013-09-24T08:52:12.867 回答
0

在不需要的 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

这应该有效。

于 2013-09-24T08:54:14.873 回答
0

将命令更新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`
于 2013-09-24T08:54:31.107 回答