Lompat ke konten Lompat ke sidebar Lompat ke footer

Python MySQL Update Table

How To Update The Selected Row In MySQL Database Table Using Python

How To Update The Selected Row In MySQL Database Table Using Python Python MySQL Update Table


import mysql.connector

connection = mysql.connector.connect(
host='localhost',
user='root', password='',
port='3306',
database='test_py'
)
c = connection.cursor()

def updateData():
update_query = """UPDATE `users_2` SET
`firstname`=%s,`lastname`=%s,
`email`=%s,`age`=%s
WHERE `id` =%s """

vals = ("NewFName","NewLName","NewEmail@gmail.com",56,5)

c.execute(update_query,vals)

connection.commit()


updateData()


OUTPUT:

How To Update The Selected Row In MySQL Database Table Using Python Python MySQL Update Table
Python MySQL Update - Before Updating

How To Update The Selected Row In MySQL Database Table Using Python Python MySQL Update Table
Python MySQL Update - After Updating




▶ Download Python Projects Source Code

Posting Komentar untuk "Python MySQL Update Table"