title: Fix a 'nesting mistake' in HTML table created by jinja for loop
body: <p>How do I display a sql table on a website using flask with Jinja template and html tables?</p>
  
  <p>Here is my code for a script "profile.html"</p>
  
  <p>I am having trouble printing the values from table "users". I get the error:</p>
  
  <blockquote>
    <p>TemplateSyntaxError: Encountered unknown tag 'endblock'. You probably
    made a nesting mistake. Jinja is expecting this tag, but currently
    looking for 'endfor' or 'else'. The innermost block that needs to be
    closed is 'for'.</p>
  </blockquote>
  
  <p>I think the problem might lie with the lines <code>{% for user in users %}</code> and <code>{% endfor %}</code>  which doesnt work with the jinja template:</p>
  
  <pre><code>{% extends "layout.html" %}
  {% block content %}
    &lt;div class="jumbo"&gt;
      &lt;h2&gt;Profile&lt;h2&gt;
    &lt;/div&gt;
  
    &lt;table class="table"&gt;
    &lt;thead&gt;
            &lt;tr&gt;
              &lt;th&gt;uid&lt;/th&gt;
              &lt;th&gt;firstname&lt;/th&gt;
              &lt;th&gt;lastname&lt;/th&gt;
              &lt;th&gt;email&lt;/th&gt;
  
            &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
            {% for user in users %}
            &lt;tr&gt;
              &lt;td&gt;{{ user.uid }}&lt;/td&gt;
              &lt;td&gt;{{ user.firstname }}&lt;/td&gt;
              &lt;td&gt;{{ comment.lastname }}&lt;/td&gt;
              &lt;td&gt;{{ user.email }}&lt;/td&gt;
  
            &lt;/tr&gt;
      &lt;/tbody&gt;  
     &lt;/table&gt;    
            {% endfor %}
  {% endblock %}
  </code></pre>
  
  <p>How can I edit them to display my SQL table on the web page?</p>