Python mySQL Update, Working but not updating table Python mySQL Update, Working but not updating table python python

Python mySQL Update, Working but not updating table


use

dbb.commit()

after

curb.execute ("UPDATE RadioGroups SET CurrentState=1 WHERE RadioID=11")

to commit all the changes that you 'loaded' into the mysql server


As the @Lazykiddy pointed out, you have to commit your changes after you load them into the mysql.

You could also use this approach to enable the auto commit setting, just after the MySQL connection initialization:

dbb.autocommit(True)

Then, it will automatically commit the changes you made during your code execution.


the two answers are correct. However, you can also do this:

dbb = MySQLdb.connect(host="localhost",    user="user",    passwd="pass",    db="database",   autocommit=True) 

add autocommit=True