title: Displaying Data from MySQL on Flask Python
body: <p>Does this work? and stored it in a database, now I want to display the same data on my own website, but it doesn't work. Help please!</p>
  <pre><code>@auth.route('/')
  def home():
      def GetBookLink():
          mydb = mysql.connector.connect(
                      host='localhost',
                      user = 'Salahudheen',
                      passwd = 'Salahudheen1!',
                      database = 'testdatabase'
                      )
          mycursor = mydb.mycursor()
  
          
          
          mycursor.execute(&quot;SELECT * FROM ScrapedBooks&quot;) 
          DBData = mycursor.fetchall() 
          mycursor.close()
           
  
      return render_template(&quot;home.html&quot;, ScrapedBookData = DBData)
  </code></pre>
  <p>HTML :</p>
  <pre><code>{% extends &quot;base.html&quot;%} {% block title %}Home{% endblock %}{% block content %}    
  &lt;h1&gt;{{ScrapedBookData}}&lt;/h1&gt;
  {% endblock %}
  </code></pre>
  <p>Of course this isn't the format I'm going to display it in, but I just want to learn how to display it first</p>