I'm trying to retrieve all the names and status from a database and print them out in a table format. I have successfully connected to the database and query it but when I print the results it will only show one row of data.
The question is how do I print all the data in a table format?
This is the code i used
The question is how do I print all the data in a table format?
This is the code i used

Code:
def dist_list(self, username ='username', password ='ZoomZoom1'):
if username == 'username' and password == 'ZoomZoom1':
cursor = conn.cursor()
cursor.execute ("SELECT listname, status FROM table")
rows = cursor.fetchall()
for row in rows:
return "%s, %s" % (row[0], row[1])
else:
return '''
<p>Username and/or Password is invalid Please try again</p>
<p><a href="index"><b>click here</b></a> to go back</p>
'''
dist_list.exposed = True
if __name__ == '__main__':
import os.path
Pconf = os.path.join(os.path.dirname(__file__), 'test.conf')
cherrypy.quickstart(Distribution(), config=Pconf)