Robert Geller
robert at worksofmagic.com
Fri Oct 29 18:34:47 EDT 2004
Hello all -- I am having trouble with mod_python 3.1.3 and MySQLdb 1.1.6 (recommended by the Andy, the author of MySQL-db). I'm just trying to get this to work, and have a test page setup, with a mysql query and fetchall statement as follows: from mod_python import apache import MySQLdb def handler(req): req.content_type = "text/html" req.write("Hello World!") db = MySQLdb.connect('localhost', 'root', 'tux5098nyu', db='imagehost') c = db.cursor() c.execute("select * from users;") results = c.fetchall() return apache.OK Now, I can't tell if the query is executing. I get NO errors from Mod Python (debugging is on), but it only displays "Hello world!" in the browser, as opposed to the results of the query rom my c.fetchall() statement. I have tried it in the Python interactive shell, and it works perfectly. I just can't tell why it won't display the query here. I have also tried it in a separate function, as follows: def mysql(req): db = MySQLdb.connect('localhost', 'root', 'tux5098nyu', db='imagehost') c = db.cursor() c.execute("select * from users;") results = c.fetchall() return results but to no avail. Thanks for your help. Robert Geller robert at worksofmagic.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20041029/cfcd8041/attachment-0001.html
|