Advertisement
Guest User

Untitled

a guest
Nov 7th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. import MySQLdb
  2. server = "sql6.freemysqlhosting.net"
  3. dbport="3306"
  4. dbuser="sql61425"
  5. password="pass"
  6. dbname="sql61425"
  7. voltage = "206"
  8. try:
  9. db= MySQLdb.connect(host=server,port=dbport,user=dbuser,passwd=password,db=dbname)
  10. cursor=db.cursor()
  11. sql="UPDATE pump SET voltage='%s'"%(voltage)
  12. try:
  13. cursor.execute(sql)
  14. db.commit()
  15. db.close()
  16. print voltage
  17. except:
  18. print "Could not update date "
  19. db.close()
  20. except:
  21. print " Could not connect cloud server database...."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement