title: Flask pagination help in Python
body: <p>I'm trying to create a button in my HTML that will go to the next/previous page when the button is clicked. I've tried pagination and peewee but didn't seem to get it to work.</p>
  
  <p>Here is my app:</p>
  
  <pre><code>from flask import Flask,render_template, request, json
  from flask_mysqldb import MySQL
  app = Flask(__name__)
  app.config['MYSQL_HOST'] = 'example'
  app.config['MYSQL_USER'] = 'example'
  app.config['MYSQL_PASSWORD'] = 'example'
  app.config['MYSQL_DB'] = 'fund_raiser'
  mysql = MySQL(app)
  
  @app.route('/funds/pages/', defaults={'page':0})
  @app.route('/funds/pages/&lt;int:page&gt;')
  def fund_pages(page):
      perpage = 5
      first_page = page*perpage
      cur = mysql.connection.cursor()
      cur.execute("select * from fund_table limit "+str(first_page)+", "+str(perpage)+";", mysql.connection.commit())
      data = cur.fetchall()
      return render_template('funds.html', data=data)
  </code></pre>
  
  <p>Where do I add the href tag in my html page? What is the correct variable to use?</p>