Abhilash Cherukat
Abhilash Cherukat

Reputation: 164

Mysql update table using webpy

I want the below query to implement in webpy using db.update

  update emp set age=age+1 where x=1`

When i tried

 db.update('emp',where='x=1',age=age+1)

This throw me an error saying global name 'age' is not defined

Upvotes: 0

Views: 88

Answers (1)

pigletfly
pigletfly

Reputation: 1081

You should use db.query instead,like this results = db.query("UPDATE emp SET age=age+1 WHERE x=$x", vars={'x':1})

Upvotes: 1

Related Questions