UPDATE VALUES FROM TABLES.py
import mysql.connector as mq
md=mq.connect(host="localhost",user="root",passwd="hacker",charset="utf8",database="sidd")
if md.is_connected():
print("connection established")
mcur=md.cursor()
a=input("ENTER THE NEW VALUE:")
b=input("ENTER THEIR ROLL_NO")
st="update mayank set name='{}' where roll_no={}".format(a,b)
mcur.execute(st)
md.commit()
mcur.execute("select * from shukla")
data=mcur.fetchall()
for i in data:
print(i)
md.close()
Comments
Post a Comment