1

I'm having trouble with this update query.INSERT works absolutely fine.My INSERT query and UPDATE query as follows,

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 :)

2
  • 2
    You should not have , after the last value. But without seeing the code that generates the query, further help is impossible Commented Sep 24, 2013 at 8:51
  • Thanks Darhazer it was the comma..cheers Commented Sep 24, 2013 at 8:58

3 Answers 3

1

Remove the last comma before the WHERE

Sign up to request clarification or add additional context in comments.

Comments

0

You have an extra comma before the Where clause which is not required

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.

Comments

0

Update the UPDATE command to this

 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 Comment

it was the comma before "cores" .thnaks for your help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.