⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

callback_after_insert primary key = 0 ??



David Leiva

David Leiva
  • profile picture
  • Member

Posted 05 October 2012 - 12:25 PM

Hello,

Very strange..
I'm using the callback_after_insert, but the $primary_key parameter is 0 but the record was inserted correctly...

I check the $this->db->insert_id() inside the callback function and same value... 0,

any ideas ?
thanks

David Leiva

David Leiva
  • profile picture
  • Member

Posted 05 October 2012 - 12:36 PM

I've fix the problem using this hack:

$record = $this->db->query('SELECT LAST_INSERT_ID()')-> row_array();
$insert_id = $record['LAST_INSERT_ID()'];

But, anyone knows why ci does not work properly ? maybe a missconfig or something?

Remco

Remco
  • profile picture
  • Member

Posted 25 February 2019 - 14:41 PM

I have this problem also now ... anybody any idea?