Welcome Guest, Not a member yet? Register   Sign In
How to get the last Inserted ID after insert data using the query builder ?

(10-05-2019, 07:44 PM)donpwinston Wrote: Did you try:

$query = $db->query("SOME QUERY");

$id = $query->resultID;

This worked:

PHP Code:
return $db->insertID(); 

The problem is that when you search the User Guide for "insert id" or "insert_id" it returns 0 results.... That is why I couldn´t find it.

But it is there: https://codeigniter4.github.io/userguide...lpers.html 

Thank you !


Messages In This Thread

Theme © iAndrew 2016 - Forum software by © MyBB