I am just trying to get the latest auto generated key from the mysql table from codeiginitor. But it is not working some how. I have tried this code $this->db->insert_id()
as well as
$this->db->mysql_insert_id()
I am getting the following error
Severity: Notice
Message: Undefined property: CI_DB_mysql_driver::$insert_id
is the insert_id function not supported for mysql? How can we make it work?
CodeIgniter's insert_id()
will only return an ID of an insert()
. Unless you are executing something like $this->db->insert('table', $data);
before calling the function it will not be able to return an ID.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With