UPDATE: Nevermind folks, I got it working. Turns out you need to commit your actions using connection.commit()
each time. Big up my mate user56700.
I'm quite new to coding, I made a program using Python and MySQL that is able to create, read, update and delete tables. For simplicity's sake, updating the table only adds pre-specified elements. The following code is responsible for the process:
mySql_Update_CV_Query = """INSERT INTO valuesTable (CVCode) VALUE (1);"""
#database = valuesBase
if userRequestUpdate == 1:
cursor
result4 = cursor.execute(mySql_Update_CV_Query)
cursor.close()
print("CVCode updated successfully.")
mySql_Update_Values_Query = """UPDATE valuesTable
SET factoryValue = 3, customValue = 0
WHERE CVCode = 1;"""
elif userRequestUpdate == 2:
cursor
result4 = cursor.execute(mySql_Update_Values_Query)
cursor.close()
print("userValue updated successfully.")
I ran the exact same queries in MySQL Workbench and they ran just fine, but when I attempted to run them this way, the table wasn't actually getting updated despite the "successful" statement printing.