Opened 6 years ago

Closed 6 years ago

#11657 closed (invalid)

Displaying Data from database(MySql)

Reported by: sumeet Owned by: nobody
Component: Uncategorized Version: 1.1
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


I am new in using Django and I want to display multiple rows from the database in my html page. I have made the necessary entries in, and in the html file. The following is my code :

Code in

def process(request):

db = MySQLdb.connect(user='root', db='books', passwd='admin', host='localhost')
cursor = db.cursor()
cursor.execute('SELECT * FROM sms_recieved_dummy')
return render_to_response('process.html', {'datas': data})

Code in process.html :

{% if datas %}


{% for d in datas %}
<li>{{ d }} </li>
{% endfor %}


{% endif %}

Here the problem is ... I want to display all the column data from each row from the database individually in my html in table format. How can i do that ?

Change History (1)

comment:1 Changed 6 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

It's not a forum ! You can report bugs here, not asking questions. Anyway you should use Django ORM instead of MySQLdb library. Ask on django irc channel or mailing list.

Note: See TracTickets for help on using tickets.
Back to Top