Мне нужно отправить SMS всем пользователям, которые не получили один
Я пытался использовать сеанс, но результат тот же. Когда я печатаю_r ($ uid), у меня есть значение
Это код блока функции My Controller
public function sendemailsms()
{
$year = $this->db->get_where('settings', array('type' => 'running_year'))->row()->description;
$attendance_report = $this->apply_model->getnosendattendanceemail();//get result
//send sms to each one
foreach($attendance_report as $sendemail)
{
//get each result details
$uid = $sendemail->uid;
$year= $sendemail->schoolyear;
$serial= $sendemail->serial_kit;
$date= $sendemail->date;
$time = $sendemail->time;
$parent_id = $this->db->get_where('student', array('loginlogout_id',$uid))->row()->parent_id;
$parent_email = $this->db->get_where('parent', array('parent_id',$parent_id))->row()->email;
$parent_phone = $this->db->get_where('parent', array('parent_id',$parent_id))->row()->phone;
$name = $this->db->get_where('student', array('loginlogout_id' => $uid))->row()->name;
$first_name = $this->db->get_where('student', array('loginlogout_id' => $uid))->row()->first_name;
if ($serial == '~SerialNumber=AIO9192060065')
{
$sms = 'Dear Rousseau International School parent, your child '.$first_name.' '.$name.' has just logged into school on '.$date.' at '.$time.'';
}
elseif($serial == '~SerialNumber=AIO9192860516')
{
$sms = 'Dear Rousseau International School parent, your child '.$first_name.' '.$name.' has just logged out of school '.$date.' at '.$time.'';
}
elseif($serial == '~SerialNumber=AIO9192860502')
{
$sms = 'Dear Rousseau International School parent, your child '.$first_name.' '.$name.' has just logged into school on '.$date.' at '.$time.'';
}
elseif($serial == '~SerialNumber=3399192800019')
{
$sms = 'Dear Rousseau International School parent, your child '.$first_name.' '.$name.' has just logged out of school '.$date.' at '.$time.'';
}
elseif($serial == '~SerialNumber=AIO9192562080'){
$sms = 'Dear Rousseau International School parent, your child '.$first_name.' '.$name.' has just logged into school on '.$date.' at '.$time.'';
}
elseif($serial == '~SerialNumber=AIO9192860505')
{
$sms = 'Dear Rousseau International School parent, your child '.$first_name.' '.$name.' has just logged out of school '.$date.' at '.$time.'';
}
else{
$sms = '';
}
// send sms
$msisdn = [''.$parent_phone.''];
//var_dump($msisdn);
$message = $sms;
$campaignTitle = 'Security';
$projectName = 'Rousseau';
if($this->apply_model->attendanceemailemail($parent_email,$date,$time,$name,$first_name) == true)
{
// update parameter
$update_sendemail = $this->apply_model->update_sendemail($uid,$year,$date,$time);
$this->envoi_sms($msisdn, $message, $campaignTitle, $projectName);
$update_sendemail = $this->apply_model->update_sendsms($uid,$year,$date,$time);
}
$this->load->view('backend/zktattendance');
}
}
**This is My Model function**
public function getnosendattendanceemail()
{
$this->db->select('*');
$this->db->from('attendance_report');
$this->db->where('sendemail',0);
$this->db->where('departement_id',2);
$this->db->where('uid !=',0,FALSE);
$query = $this->db->get();
return $query->result();
}