execute sql command in python -


when run code in raspberry-pi nothing happend , code runs smouthly there no results

#!/usr/bin/python import mysqldb  db = mysqldb.connect(host="localhost", # host, localhost                  user="root", # username                   passwd="raspberry", # password                   db="raspberry") # name of data base   cur = db.cursor()    cur.execute("update visitors set nb_visits = nb_visits+1 id = 1") 

you should commit transaction before changes take effect :

cur.execute("update visitors set nb_visits = nb_visits+1 id = 1") db.commit() 

Comments

Popular posts from this blog

IF statement in MySQL trigger -

c++ - What does MSC in "// appease MSC" comments mean? -

javascript - Blogger related post gadget image Resize s72-c [ Need Expert Help ] -