Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. import mysql.connector
  2.  
  3. mydb = mysql.connector.connect(
  4.     host="localhost",
  5.     user="root",
  6.     password="",
  7.     database="WebApp_DB"
  8. )
  9. myc = mydb.cursor()
  10. sql_formula = 'INSERT INTO korisnik (ID, name) VALUES (NULL, %s);'
  11. myc.execute(sql_formula, (name,))
  12. mydb.commit()
  13. mydb.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement