title: Fetching and display the data in a Django Template Using MYSQL RAW SQL QUERY
body: <p>Here is my Django Template Used to Display The data in table Format...</p>
  
  <p><code>enter code here</code></p>
  
  <pre><code>&lt;table class="content" border="2px"&gt;
    &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;S-No&lt;/th&gt;
      &lt;th&gt;Name&lt;/th&gt;
      &lt;th&gt;Email&lt;/th&gt;
      &lt;th&gt;Productname&lt;/th&gt;
      &lt;th&gt;Quantity&lt;/th&gt;
      &lt;th&gt;Price&lt;/th&gt;
      &lt;th&gt;Ordertime&lt;/th&gt;
      &lt;th&gt;Orderstatus&lt;/th&gt;
      &lt;th&gt;Actions&lt;/th&gt;
    &lt;/tr&gt;&lt;/thead&gt;
    &lt;tbody&gt;
      {% for row in records %}
    &lt;tr align="center"&gt;    
      &lt;td&gt;{{row.pid}}&lt;/td&gt;
      &lt;td&gt;{{ row.username }}&lt;/td&gt;
      &lt;td&gt;{{ row.email }}&lt;/td&gt;
      &lt;td&gt;{{ row.productname }}&lt;/td&gt;
      &lt;td&gt;{{ row.quantity }}&lt;/td&gt;
      &lt;td&gt;{{ row.price }}&lt;/td&gt;
      &lt;td&gt;{{ row.ordertime }}&lt;/td&gt;
      &lt;td&gt;{{ row.orderstatus }}&lt;/td&gt;
      &lt;td&gt;&lt;input type="submit" value="Accept"&gt;  &lt;input type="button" value="Reject"&gt;&lt;/td&gt;
    &lt;/tr&gt;
    {% endfor %}
  &lt;/tbody&gt; 
  &lt;/table&gt;
  </code></pre>
  
  <p>And This is my Views.py Page for the fetching up of the data</p>
  
  <pre><code> def viewpro(request):
      con = mysql.connector.connect(user='root', password='', host='localhost', database='company1')
      cur = con.cursor()
      cur.execute("SELECT * FROM user_order")
      records=cur.fetchall()
      print(records)
      con.commit()
      cur.close()
      con.close()
      #context = {'viewpro' : user_order.objects.all()}
      return render(request, "viewpro.html", {'records':records})
  </code></pre>
  
  <p>But Here The problem is it display the no.of table rows same like DB(It have 4 records and table shows 4 rows But no data in the fields).....Pls Help me to get rid of that....Only using raw queries....</p>