Here is what i am trying to do:
import mysql.connector
mydb = mysql.connector.connect(
host="localhost",
user="root",
passwd="",
database="J"
)
mycursor = mydb.cursor()
sql = "UPDATE account SET balance = '100' WHERE address = 'input()'"
mycursor.execute(sql)
mydb.commit()
print(mycursor.rowcount, "record(s) affected")
I want to know how to put input within the SQL command? Any other ways than that? I know in php that you put it within , but in python? And what this code is all about is to refill or decrease customer balance. like in db i got accounts and ofcourse there are alot of customers. How to make it so that it changes according to my input? thanks for reading.