How can I fetch the last row I inserted using DBI?

后端 未结 3 387
臣服心动
臣服心动 2020-12-17 07:39

How can I fetch the last row that was inserted using DBI (DBD::mysql)?

Code sample:

my $sth = $dbh->prepare(\'INSERT INTO a ( x, y, z ) VALUES ( ?         


        
3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-17 08:41

    SELECT LAST_INSERT_ID() query will also return what you want.

提交回复
热议问题