title: My results are truncating into a single row. How do I get it to print everything?
body: <p>This is my code:
  '</p>
  
  <p>import pyodbc
      import pandas as pd
      from flask import Flask, request, render_template</p>
  
  <pre><code>app = Flask(__name__)
  
  
  @app.route('/')
  def attendance_fetch():
      return render_template('Attendance_fetch.html')
  
  
  @app.route('/Attendance', methods=['GET', 'POST'])
  def database_file():
      df = 0
      if request.method == 'POST':
  
          employee = request.form['employee_code']
  
          conn = pyodbc.connect(
              r'Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=file_location;')
          cursor = conn.cursor()
          cursor.execute('select * from Employees where EmployeeCode =?', employee)
  
          for i in cursor.fetchall():
              employee_id = str(i[0])
              cursor.execute('select EmployeeID, AttendanceDate, InTime, OutTime, TotalDurationinHHMM'
                             ' from AttendanceLogs where EmployeeId=?', employee_id)
              columns = [column[0] for column in cursor.description]
              print(columns)
              results = []
              for row in cursor.fetchall():
                  results.append(dict(zip(columns, row)))
              for result in results:
                  final = [result]
                  df = pd.DataFrame(final)
  
              return render_template('Testrun2.html', tables=[df.to_html(classes='data')], 
              titles=df.columns.values)
  
          cursor.close()
          conn.close()
  
  
  if __name__ == '__main__':
      app.run(debug=True)
  </code></pre>
  
  <p>'</p>
  
  <p>and then I wrote a html file to catch it:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;Attendance Table&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  {% for table in tables %}
              {{titles[loop.index]}}
              {{ table|safe }}
  {% endfor %}
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/4pqQd.jpg" rel="nofollow noreferrer">But the result is just a singular truncated column:</a>
  I would like for every row of result to be printed. Thanks in advance.</p>