fedorp1 fedorp1 - 9 months ago 21
SQL Question

Python MySQLdb Query Returns "None"

I'm running the following code with web.py to get mysql data and print it out on a webpage. For some reason, when I query the webpage, I get just the word "None". Any idea what the problem is? There is some data in the MySQL database, the credentials are valid, and the code is running without any errors.

import web
import MySQLdb
import json
import collections


urls = (
'/', 'index',
'/test', 'test'

class index:
def GET(self):
SELECT email, password
FROM users

rows = c.fetchall()



I think your code fragment may be either incomplete or misformatted, but assuming it is not, the GET method has no return statement, which means that any invocation would return None, which in turn would be rendered as the string "None"