how to get last inserted Id of a Sqlite database using Zend_Db

后端 未结 5 869
-上瘾入骨i
-上瘾入骨i 2021-01-13 08:55

I\'m trying to fetch the last inserted row Id of a Sqlite DB in my PHP application. I\'m using Zend Framework\'s PDO Sqlite adapter for database handling. the lastInsertId()

5条回答
  •  悲哀的现实
    2021-01-13 09:33

    Hey, try this query. But I don't know about PHP.

    SELECT *
    FROM tablename
    WHERE id = (SELECT COUNT(*) FROM tablename);
    

提交回复
热议问题