[mod_python] Re: error while inserting data

Daniel Nogradi nogradi at gmail.com
Mon Jan 9 11:02:24 EST 2006


Inserting variables of type string into other strings goes like this:

name = "John"
formatted_string = "your name is: %s" % name

or with more variables:

name = "John"
age = "13"
formatted_string = "your name is: %s and your age is: %s" % ( name, age )

Thus you should have:

cursor.execute("INSERT INTO PERSONALDETAILS
(firstname,middlename,lastname) VALUES (%s, %s, %s)" %
(fname,mname,lname) )

Note the % sign.



More information about the Mod_python mailing list