if($c_type=='Telephone_Counseling')
{
$qry="SELECT eemp_id,email FROM book_tele_counseling_mstr WHERE CaseId='" . $cid . "'";
$query=$this->db->query($qry);
// return $query->result();
foreach($query->result() as $row)
{
$eemp_id=$row->eemp_id;
$email=$row->email;
}
$this->email->initialize($this->config);
$message_str = 'Your session is closed';
$this->email->from('no.reply@santulan.co.in', 'Santulan Suport Team');
$this->email->to($email);
$this->email->subject("This is mail from counselor");
$this->email->message($message_str);
$this->email->send();
}
在上面的代码中,我应该从上面的查询中得到结果,但调试器在调试代码时没有进入foreach循环
答案 0 :(得分:2)
您尝试访问$query->result
(一个不存在的属性)而不是$query->result()
(方法)。
答案 1 :(得分:2)
$query->result
foreach($query->result as $row)
这将是
foreach($query->result() as $row)