I am trying to display my Model query return result in my controller, but I don't know how to do it. could you please show me? Thanks in advance
Controller:
function updateJobsheetCDC()
{
$prnID = $this->input->post('prnID');
$this->load->model('Ipss_model');
$data['prnEmail'] = $this->Ipss_model->prnEmailList($prnID);
echo $data['prnEmail']['name'];
}
Model:
function prnEmailList($prnID)
{
$q = $this->db->query("SELECT pm.* , prm.*,e.* from principal_master pm ,principal prm,email e where pm.prnID=e.prnID and prm.prID= pm.prID and e.prnID='" .$prnID."'");
if($q->num_rows()>0) {
foreach($q ->result() as $row)
{
$data[] = $row;
}
return $data;
}
}
I have tried echo $data['prnEmail']['name']; but it do not work. It shows Severity: Notice
Message: Undefined index: name.