[英]PHP SQL UPDATE Query issue
我在使用此更新查詢時遇到問題。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
)
)
謝謝你的幫助 :)
刪除WHERE
之前的最后一個逗號
在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
這應該工作。
將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.