How to get last insert ID in Codeigniter
Last Modified at 2019-06-25 21:29:25
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.