Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. def addcart():
  2. cur = mysql.connection.cursor()
  3. if 'uid' not in session:
  4. noOfItems = 0
  5. else:
  6. uid = session['uid']
  7. cur.execute("SELECT count(id_phone) FROM cart WHERE id_users = " + str(uid))
  8. noOfItems = cur.fetchall()
  9. return (noOfItems)
  10.  
  11.  
  12. @app.route('/')
  13. def index():
  14. noOfItems = addcart()
  15. return render_template("index.html", noOfItems=noOfItems)
  16.  
  17. <a href="#" class="btn btn-more i-left">
  18. <small><span class="badge badge-primary">{{noOfItems}}</span></small>
  19. </a>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement