title: Trouble getting a function's output to print on a new page using flask
body: <p>Ok, I've been trying to do this for almost 10 hours now, and I can't figure it out. I have a restaurant search app, which works when printing the output to the terminal, but I have no idea how to get it to print on a new page. This is what I have so far:</p>
  
  <pre><code>@app.route('/')
  def results(area, rating, food):
      conn = sqlite3.connect('SRG.db')
      c = conn.cursor()
  
      c.execute('SELECT * FROM restaurants WHERE address LIKE "%%%s%%" \
          AND rating &gt; %s-1 AND type LIKE "%%%s%%" ORDER BY rating DESC' \
          % (area, rating, food,))
  
      while True:
  
          row = c.fetchone()
  
          if row == None:
              break
  
          print 'Name:    ',row[1]
          print 'Rating:  ',row[3]
          print 'Price:   ',row[2]
          print 'Type:    ',row[4]
          print 'Website: ',row[5]
          print 'Address: ',row[6]
          print 'Subway:  ',row[7]
          print 'Phone:   ',row[8],'\n'
  
      return render_template('results.html', row=row)
  </code></pre>
  
  <p>Now, that part works and prints to the terminal. I have a problem printing it to an html page. This is the template that I have so far:</p>
  
  <pre><code>    &lt;head&gt;
          &lt;meta charset="UTF-8"&gt;
          &lt;title&gt;Here are your results&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
      &lt;h1&gt;Check out these restaurants&lt;/h1&gt;
      &lt;ul&gt;
          {% for row in results %}
              &lt;p&gt;Name:    {{ row[1] }}&lt;/p&gt;
              &lt;p&gt;Rating:  {{ row[3] }}&lt;/p&gt;
              &lt;p&gt;Price:   {{ row[2] }}&lt;/p&gt;
              &lt;p&gt;Type:    {{ row[4] }}&lt;/p&gt;
              &lt;p&gt;Website: {{ row[5] }}&lt;/p&gt;
              &lt;p&gt;Address: {{ row[6] }}&lt;/p&gt;
              &lt;p&gt;Subway:  {{ row[7] }}&lt;/p&gt;
              &lt;p&gt;Phone:   {{ row[8] }}&lt;/p&gt;
          {% endfor %}
  
  
              &lt;p&gt;&lt;em&gt;Sorry, no restaurants fit that criteria&lt;/em&gt;&lt;/p&gt;
  
      &lt;/ul&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>Could someone please help? I feel like it is something minor and it is driving me crazy! It would be the best Christmas present ever!</p>