Reputation: 897
Trying to get last inserted id using this line: $db->insert_id;
but it doesn't return anything in the latest version of ezsql.
Upvotes: 0
Views: 274
Reputation: 11
Using a select to get the last id may work but not always. If 2 users or more are inserting at the same time, you may not get the right id. $db->insert_id
has been replaced by $db->getInsert_Id()
Upvotes: 1
Reputation: 897
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.
Upvotes: 0