Guest User

Untitled

a guest
Nov 1st, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #!/usr/bin/python
  2. #-*- coding: utf-8 -*-
  3. import mysql.connector as mariadb
  4.  
  5. user='root'
  6. passb='xxx'
  7. basename='xxx'
  8. mariadb_connection = mariadb.connect(user=user, password=passb, database=basename)
  9. cursor = mariadb_connection.cursor()
  10.  
  11. cursor.execute("SELECT * FROM users")
  12.  
  13. for field1, field2, field3, field4 in cursor:
  14. print("Name: {}, Sex: {}, Age: {}, Comment: {},").format(field1,field2,field3,field4)
  15.  
  16.  
  17. mariadb_connection.commit()
  18. mariadb_connection.close()
  19.  
  20. print ("Content-type:text/htmlrnrn")
  21. print ("<h1>Test message</h1>")
  22.  
  23. <form action="/cgi-bin/connectbase.py" method="POST" target="_self">
  24. <input type="submit" value="Просмотр" /></form>
Add Comment
Please, Sign In to add comment