[Tutor] mod_python & mysqldb problem
Patty
patriciap.gu at gmail.com
Thu Feb 23 20:58:02 CET 2006
Hi!
I'm new to python and MySQl and have problems trying to figure out what is wrong
with my code. I have two files:
***control.py***
#!/usr/bin/python
import MySQLdb
def addpercent(mp, lp):
conn = MySQLdb.connect(host = "localhost", user = "root", passwd = "",db
="my_db")
cursor = conn.cursor()
cursor.execute ("""
UPDATE targets
SET mario_percent = %d, lizard_percent = %d
WHERE target_name = 'anyname'
""", (mp, lp))
db.commit()
cursor.close()
db.close()
*******controlcenter.html******
<html>
<title>Ants Control Center</title>
<body>
<form action = "control.py/addpercent" method="POST">
mario:<input type= "text" name="mp">
lizard:<input type= "text" name="lp">
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html>
**********************************
This is what i found in error_log
[Thu Feb 23 13:08:07 2006] [notice] mod_python: (Re)importing module
'mod_python.publisher'
[Thu Feb 23 13:08:07 2006] [notice] mod_python: (Re)importing module 'control'
with path set to '['/var/www/html/mptest']'
[Thu Feb 23 13:08:08 2006] [notice] child pid 6405 exit signal Segmentation
fault (11)
****************************************
There is no reference to php in the httpd.conf file. Someone had told me that
that could be the problem.
I'd appreciate your help.
More information about the Tutor
mailing list