Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pymysql
- from readTask import tampil
- connection = pymysql.connect(
- host='localhost',
- user='root',
- password='',
- db='buku',
- )
- tampil()
- menu = input('pilih id buku : ')
- jdl = input('update title buku : ')
- cat = input('update category buku : ')
- hrg = int(input('update harga buku : '))
- try:
- with connection.cursor() as cursor:
- sql = "UPDATE buku SET `title`, `category`, `harga` WHERE `id_buku` ="+str(menu)
- try:
- cursor.execute(sql, (jdl, cat, hrg, menu))
- print("Successfully Updated...")
- except pymysql.Error as e:
- print("Oops! Something wrong", e)
- connection.commit()
- finally:
- connection.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement