Manfred Stienstra
manfred.stienstra at dwerg.net
Thu Jan 22 18:58:22 EST 2004
On Thu, 2004-01-22 at 15:37, Ross M Karchner wrote: > In mozilla, it loads a blank page, on Safari, I get a "page returned no > data" error. This is because you're not returning any data... > The code in display-rss.py is: > ------------------------------- > DB = "db" > USER = "user" > PASS = "password" > > import MySQLdb > > def index(req): > > DB_CONN = MySQLdb.connect(db=DB, user=USER, passwd=PASS) > C=DB_CONN.cursor() > C.execute('select * from cities where id=17;') > return "Something" Maybe you should try something like this: DB = "db" USER = "user" PASS = "password" import MySQLdb from mod_python import apache def index(req): DB_CONN = MySQLdb.connect(db=DB, user=USER, passwd=PASS) C=DB_CONN.cursor() try: C.execute('select * from cities where id=17;') for row in c.fetchall(): req.write(str(row)) return apache.OK finally: C.close() DB_CONN.close() Manfred
|