On Wed, Dec 05, 2001 at 11:03:59AM -0500, Vaughan, Penny wrote:
> Nothing like a good night's sleep...
>
> The crux: using the database handle to get with mysql_insertid just
> doesn't seem to work anymore, however using the statement handle
> ($sth->{mysql_insertid'}) is working.
>
> I was getting zeros because I didn't realize that "The last ID that
> was generated is maintained in the server on a per-connection
> basis." (http://www.mysql.com/doc/M/i/Miscellaneous_functions.html)
> and I had isolated the code to return the id without bringing an
> insert statement along that would generate an id for that
> connection. I'm still getting 0 if I use the database handle
> despite the note in the Perl DBI section of the manual that still
> says you can use that as an alternative.
$dbh->{mysql_insertid} should work.
Apologies if this was already discussed, but is it possible that you
upgraded your mysql server without recompiling and reinstalling
DBD::mysql (linked to the new mysql libraries)? I've had wierd things
like this show up when DBD::mysql is out of date with the mysql shared
libraries.
Good luck,
Chuck