You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

20 rivejä
580 B

  1. import mysql.connector
  2. def UpdateData(device, browser, date, session_id):
  3. mydb = mysql.connector.connect(
  4. host = "localhost",
  5. user = "root",
  6. password = "1234",
  7. database = "mydatabase"
  8. )
  9. mycursor = mydb.cursor()
  10. #sql = "CREATE TABLE user_information (Name VARCHAR(255), Email VARCHAR(255), Date VARCHAR(255), Session ID VARCHAR(255));"
  11. sql = 'INSERT INTO user_device_information VALUES ("{}", "{}", "{}", "{}");'.format(device, browser, date, session_id)
  12. mycursor.execute(sql)
  13. mydb.commit()
  14. print("Successful!")