Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sql_insert = ("INSERT INTO `Products` (title) VALUES(%s)"),(data)
- import mysql.connector
- from mysql.connector import errorcode
- cnx = mysql.connector.connect (user='userDB1', password='UserPwd1',
- host='somedatabase.com', database='mydatabase1')
- cursor = cnx.cursor()
- sql_insert = ("INSERT INTO `Products` (title) VALUES(%s)")
- data=('HelloSQLWORLD')
- cursor.execute(sql_insert,data)
- cnx.commit()
- cnx.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement