Help for this page

Select Code to Download


  1. or download this
    $dbh->do("LOCK TABLES tbl WRITE");
    $dbh->do("INSERT INTO tbl VALUES(NULL,'foo','bar')");
    my $ref = $dbh->selectcol_arrayref("
        SELECT LAST_INSERT_ID() FROM tbl");
    $dbh->do("UNLOCK TABLES");
    
  2. or download this
    DATABASE HANDLES
    The DBD::mysql driver supports the following attributes of database ha
    ...
    +te is not valid for DBD::mSQL. An alternative way for accessing this 
    +a
    +ttribute is via $dbh->{'mysql_insertid'}. (Note we are using the $dbh
    + 
    +in this case!)