i have a trouble when retrieve last insert id in codeigniter. when i try to debug like var_dump(); the output just send int(0)
i use uuid as id with primary key. this is the code:
$this->db->set('id_customer','uuid_short()',FALSE);
$query = $this->db->insert('customer',$data);
$id = $this->db->insert_id();
echo var_dump($id);
if($query)
{
$array = array(
'kode_trans' => 'uuid()',
'trans_date' => 'NOW()'
);
$this->db->set('id_customer','$id');
$this->db->set($array,'',FALSE);
$this->db->insert('transaction_header');
return $id;
}else{
return FALSE;
}
im newbie in ci. there is something wrong with my code?