Search code examples
databaseezsql

how to get last_inserted_id in ezsql latest version 4?


Trying to get last inserted id using this line: $db->insert_id;

but it doesn't return anything in the latest version of ezsql.


Solution

  • No one posted an answer, what I did finding the last id inserted into the table, like this

    $last_inserted = $this->db->get_var("select product_id from oc_product order by product_id desc");
    

    maybe there is a direct solution but I searched the documentation and didn't find it, so I used this line of code.