我遇到了这个更新查询的麻烦.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
)
)
感谢您的帮助:)
答案 0 :(得分:1)
删除WHERE
答案 1 :(得分: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
这应该有用。
答案 2 :(得分: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`