#!/usr/bin/env python
import cgitb; cgitb.enable()
import cgi
import MySQLdb

print 'Content-type: text/html\n'
print "Hello world, from Python"

db = "wanderin_test"   # your username (= login name  = account name )
host = "localhost"     # = "localhost", the server your are on.
user = "wanderin_stan" # your Database name is the same as your account name.
passwd = "fortune"     # Your account password

db = MySQLdb.connect(db=db, host=host, user=user, passwd=passwd)

myquery = "SELECT * FROM test"

c = db.cursor()
c.execute(myquery)
results = c.fetchall()

print results

"""
form = cgi.FieldStorage()
if not (form.has_key("name") and form.has_key("addr")):
    print "<H1>Error</H1>"
    print "Please fill in the name and addr fields."
    
print "<p>name:", form["name"].value
print "<p>addr:", form["addr"].value
"""
