2013-09-24 114 views
1

我有這個更新內容如下query.INSERT工作絕對fine.My INSERT查詢和更新查詢的麻煩,PHP SQL更新查詢問題

這是我一直得到錯誤。

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 
     ) 

) 

感謝您的幫助:)

+2

你不應該有','最後一個值之後。但沒有看到生成查詢的代碼,進一步的幫助是不可能的 –

+0

感謝Darhazer,它是逗號..簽名 – Carter

回答

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 

這應該工作。

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` 
+0

它是「核心」之前的逗號.thnaks爲您提供幫助 – Carter