I have script, which is running under CGIHTTPServer.
Script contains:
$ cat cgi-bin/mysql.py
#!/usr/bin/env python
print "Content-Type: text/html"
print
print """
<html>
<body>
<h2>Test</h2>
<button type="button">Get version</button>
</body>
</html>
"""
And function (in other script or this):
def myver(host, user, pwd, cmd):
db = MySQLdb.connect(host, user, pwd)
cursor = db.cursor()
cursor.execute(cmd)
data = cursor.fetchone()
print "Database version : %s " % data
db.close()
myver('localhost', 'username', 'megapass', 'SELECT VERSION()')
How can I get result of this function on to same web-page?
Links to HowTo's will be perfect. Or some examples.