VDS
VDS

Reputation: 47

Not able to call php function after database query result codeigniter

Please find below code

//--Sec A--
$query = $this->db->insert('test',$insert_data);
$data['test_data'] = $query->result();

// --Sec B--- code to get inserted row

$this->addPanels($panArr,$job_Id,$test_Id);//$test_Id is result of Sec B

echo json_encode($data);//Result of Sec A

I am unable to understand why i am unable to get result of addPanels()

Upvotes: 1

Views: 81

Answers (1)

Tpojka
Tpojka

Reputation: 7111

//--Sec A--
$query = $this->db->insert('test',$insert_data);
$data['test_data'] = $query->result();

//The insert ID number when performing database inserts.
$test_Id = $this->db->insert_id();

// --Sec B--- code to get inserted row

$this->addPanels($panArr,$job_Id,$test_Id);//$test_Id is result of Sec B

echo json_encode($data);//Result of Sec A

Upvotes: 1

Related Questions