I am following mvc structure in PHP and I want to retrieve last inserted row ID.
I have created following sql code:
$sql = \"INSERT
You're almost there.
If you look at the manual page for lastInsertId, it's called on the database handle - you're currently calling it on the statement.
You just need to call:
$this->db->lastInsertId();