Advertisement
Guest User

Untitled

a guest
Sep 12th, 2016
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. import sqlite3
  2. try:
  3. db = sqlite3.connect('db.sqlite3')
  4.  
  5. cursor = db.cursor()
  6.  
  7. print "Sign Up now !"
  8. name = raw_input("Your Name: ")
  9. email = raw_input("Your Email: ")
  10. password = raw_input("Your Password: ")
  11.  
  12. cursor.execute('''INSERT INTO users(name, email, password) VALUES(:name, :email, :password)''', {'name': name, 'email': email, 'password': password})
  13. db.commit()
  14.  
  15. print "You have been registered !"
  16.  
  17. cursor.execute('''SELECT * FROM users WHERE email=?''', (email,))
  18. user = cursor.fetchone()
  19.  
  20. print "Your name is: ", user[1]
  21. print "Your email is: ", user[2]
  22. print "Your password is: ", user[3]
  23.  
  24. '''fh = open('script.txt', 'r')
  25. script = fh.read()
  26. cursor.executescript(script)
  27. print "Executed"'''
  28. except Exception as e:
  29. db.rollback()
  30. raise e
  31. finally:
  32. db.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement