My requirement is to change the name field to sun if id is 1.Below is my code.It throws exception and print error in update?.Is i am doing anything wrong on query or python code?
import MySQLdb
import datetime
a="sun"
b=1
sql="update selva set name=%s where selid=%d"
try:
cursor.execute(sql,[a,b])
db.commit()
except:
print "error in update"
db.rollback()
db.close()
Any Help will be greatly appreciated!