retrieve auto-increment value
In a perl cgi I successfully add a record to a table that has an auto-increment primary key (myEventID)
I can build an SQL statement that will add a record and return the value of myEventID and run it in myPHPAdmin
However I cannot figure out what the perl code equivalent is.
I'm trying this...(after connecting to the db) It does create the record, but does not return the autoincrement value.
#snippet
$SQLInsert="INSERT INTO $sqltable SET $SET; SELECT LAST_INSERT_ID()";
$sqlcommand = $dbh->prepare($SQLInsert);
$sqlcommand->execute();
my $sqlAutoIncrement = $sqlcommand->{'mysql_insertid'};
print "\n\$sqlAutoIncrement $sqlAutoIncrement\n";
$sqlcommand->finish();
$dbh->disconnect ( );
TIA for any help on this.
Paul
Subject
Written By
Posted
retrieve auto-increment value
May 25, 2009 08:54PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.