Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import MySQLdb
- db = MySQLdb.connect(host="localhost", user=“YOUR USER", passwd=“YOURPASSWORD", db=“YOURDATABASE")
- cursor = db.cursor()
- sql = "INSERT INTO YOURTABLENAME (COLUMN1, COLUMN2, COLUMN3) VALUES ('%s', '%c', '%d' )" % (String Variable, Character Variable, Integer Variable)
- try:
- cursor.execute(sql)
- db.commit()
- except:
- db.rollback()
- db.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement