Advertisement
Guest User

Untitled

a guest
Sep 25th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. sql_insert = ("INSERT INTO `Products` (title) VALUES(%s)"),(data)
  2.  
  3. import mysql.connector
  4. from mysql.connector import errorcode
  5.  
  6. cnx = mysql.connector.connect (user='userDB1', password='UserPwd1',
  7. host='somedatabase.com', database='mydatabase1')
  8. cursor = cnx.cursor()
  9.  
  10. sql_insert = ("INSERT INTO `Products` (title) VALUES(%s)")
  11.  
  12. data=('HelloSQLWORLD')
  13.  
  14. cursor.execute(sql_insert,data)
  15.  
  16. cnx.commit()
  17.  
  18.  
  19. cnx.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement