$cc = $this->db->count_all('job_card'); $coun = str_pad($cc,4,STR_PAD_LEFT); $id = "JI"."-"; $d = date('y') ; $mnth = date("m"); $customid = $id.$d.$mnth.$coun;
(05-29-2018, 09:49 PM)azmath Wrote: Code:$cc = $this->db->count_all('job_card'); $coun = str_pad($cc,4,STR_PAD_LEFT); $id = "JI"."-"; $d = date('y') ; $mnth = date("m"); $customid = $id.$d.$mnth.$coun;Help me: I am generating "JI-18051000" This id. But i need "JI-18050001" this id.
$result = $this->db->select('max("id") as max_id', false)->from('job_card')->get(); $coun = $result['max_id'] + 1;