How to get last insert ID in Codeigniter
Last Modified at 2020-03-22 18:03:30
I assume, you must be creating a website where you are looking to get last insert id of executed INSERT query in parent table and then you want to store the last inserted ID in your child table as a foreign key.
In this post, i am going to share with you guys a small Codeigniter method that will help you to get last inserted id.
Here it is:
Run this peace of code after insert query and this method will return you last inserted id of the executed query.
I hope this post will help.