尝试获取非对象的属性时出错

时间:2019-10-15 14:13:43

标签: codeigniter

我需要向所有未收到短信的用户发送短信

  

我尝试使用会话,但结果相同。当我   print_r($ uid),我有一个值

这是“我的控制器”功能组代码

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();  
      }

0 个答案:

没有答案