Tuesday, May 22, 2012

PDO get the last ID had inserted

I have a query and i want to get the last ID had inserted , the filed ID is primary key and auto increment

i know that i have to use this statement


That statement works with me when the query like this

$query = "INSERT INTO `cell-place` (ID) VALUES (LAST_INSERT_ID())";

But if i want to get that ID using this statement


I have got this error

Fatal error: Call to undefined function LAST_INSERT_ID()

What am i doing wrong please

No comments:

Post a Comment