[DB-SIG] Mysql insert_id() questions
Andrew Diller
dillera@isc.upenn.edu
Thu, 2 Dec 1999 15:50:42 -0500 (EST)
Hello:
I'm trying to grab the auto_increment value of my most recent insert. The
MySQL manuals and the MySQLdb both mention the mysql_insert.id() which
does exactly this.
I'm getting an error though, in my cgi code:
------------------
db = MySQLdb.Connection(db='example', user='test', passwd='dontlook');
cursor = db.cursor()
.... sometime later:
cursor.execute("INSERT into database some stuff")
recordKey = db.insert_id()
I get an attribute error on the assignment:
File "/usr/local/apache/htdocs/usginfo/incident.py", line 142, in
ProcessForm
recordKey = db.insert_id()
AttributeError: insert_id
Does anyone have a sucessful code snippet to retreive this value from
MySQL?
thanks,
andy diller