PDO lastInsertId() always return 0

前端 未结 5 482
花落未央
花落未央 2020-11-29 12:14

I\'ve come across with a problem. My framework was working just fine with PHP 5.3.0. I upgraded my PHP version to PHP 5.4.x and I started to have few issues with some parts

5条回答
  •  [愿得一人]
    2020-11-29 12:38

    When no exception is thrown, lastInsertId returns 0. However, if lastInsertId is called before calling commit, the right id is returned.

    http://php.net/manual/es/pdo.lastinsertid.php

提交回复
热议问题