Advertisement
Guest User

Untitled

a guest
Jan 27th, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. from flask import Flask,render_template,request,url_for
  2. import pymysql
  3.  
  4. app = Flask(__name__)
  5. db = pymysql.connect('localhost','root','','imsDB')
  6.  
  7.  
  8. @app.route('/')
  9. def home():
  10. cur = db.cursor()
  11. cur.execute("select * from costomer")
  12. costomer = cur.fetchall()
  13. print(costomer)
  14. return render_template('index.html',datacostomer=costomer)
  15.  
  16. @app.route('/test', methods=['GET', 'POST'])
  17. def test():
  18.  
  19. select = request.form['Customer_Type']
  20. print(select)
  21. print("test")
  22. return (str(select))
  23.  
  24.  
  25.  
  26.  
  27. if __name__ == '__main__':
  28. app.run(debug=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement