[DB-SIG] MySQLdb +cgi

Jackson david.jay.jackson@wcox.com
Tue, 30 Oct 2001 11:09:16 -0700


I would appricate a little help with script below. The "node" field is being grabbed fine. But it's not being passwd to the db underneeth.

Thanks.
David



#!/usr/bin/python
import cgi, MySQLdb
print "Content-Type: text/html\n"

form = cgi.FieldStorage()
if form.has_key("node"):
	host=form["node"].value
	print "<p>"
	print "Hostname: ",host
	print "</p>"
	db = MySQLdb,connect("localhost","davej","F10wer$","sirinfo")
	rca = db.cursor()
	rca = execute(""" insert into test(node) values(?) """,[host])	
	
else:
	print "<h1>Dis doesn't look right</h1>"