Письмо отправлено с одним l oop заполненным в CodeIgniter - PullRequest
0 голосов
/ 09 января 2020

Это мой л oop. Все отлично, но когда я пытался отправить почту, они отправляли все значения одновременно. Я хочу отправить значение одного массива одному пользователю, другой массив другому пользователю.

Array
(
    [0] => stdClass Object
        (
            [g_recid] => 393
            [log_roll] => 9
            [first_name] => Akshat
            [last_name] => Vyas
            [team_id] => 12
            [assign] => 
        )

    [1] => stdClass Object
        (
            [g_recid] => 297
            [log_roll] => 9
            [first_name] => Aparna
            [last_name] => Samadhiya
            [team_id] => 12
            [assign] => 
        )

    [2] => stdClass Object
        (
            [g_recid] => 186
            [log_roll] => 7
            [first_name] => Purnima
            [last_name] => Niley
            [team_id] => 12
            [assign] => 
        )

    [3] => stdClass Object
        (
            [g_recid] => 361
            [log_roll] => 9
            [first_name] => Shruti
            [last_name] => Soni
            [team_id] => 12
            [assign] => 
        )

)

Array
(
    [0] => stdClass Object
        (
            [g_recid] => 157
            [log_roll] => 7
            [first_name] => Aniket
            [last_name] => khare
            [team_id] => 5
            [assign] => 
        )

    [1] => stdClass Object
        (
            [g_recid] => 183
            [log_roll] => 6
            [first_name] => Nishant
            [last_name] => Shah

            [team_id] => 5
            [assign] => 
        )

    [2] => stdClass Object
        (
            [g_recid] => 368
            [log_roll] => 9
            [first_name] => shivraj

            [last_name] => chouhan

            [team_id] => 5
            [assign] => 
        )

    [3] => stdClass Object
        (
            [g_recid] => 318
            [log_roll] => 9
            [first_name] => Shubham
            [last_name] => Lokre      
            [team_id] => 5
            [assign] => 
        )

    [4] => stdClass Object
        (
            [g_recid] => 288
            [log_roll] => 9
            [first_name] => Suyash
            [last_name] => Lachhwani      
            [team_id] => 5
            [assign] => 
        )

)

Мой код:

public function getemailremind(){
        $from_date = $this->input->post('from_date');
        $from_time = $this->input->post('from_time');
        $to_date = $this->input->post('to_date');
        $to_time = $this->input->post('to_time');
        $data = $this->mrequirementreportnew->sendreminder($from_date,$from_time,$to_date,$to_time);

        //echo "<pre>";print_r($data);
        $subject = "Alert! Requirement not assigned";
        $msgdata = "";

        $msgdata .= "<p>Description: Requirement not assigned to following Recruiters. Please allocate the requirement asap.</p>";
        $msgdata .= "<br/>";
        $msgdata .= "<br/>";  
        if($data!=''){
            foreach ($data as $key => $value) {
                 $msgdata .= "<table>";
                foreach ($value as $k => $v) {
                    foreach ($v as $k1 => $v1) {
                        $msgdata .= "<tr><td>".$v1->first_name." ".$v1->last_name."</td></tr>";
                    }

                }
                 $msgdata .= "</table>";
            }
        }

        $msgdata .= "<br/><br/>- Demo team<br/>";

        //print_r($msgdata);

        $config = emailconfig();
        $this->email->initialize($config);
        $this->email->clear(TRUE);
        $this->email->set_newline("\r\n");
        $this->email->from("info@demo.com","demo");//$arr[0]->u_email
        $this->email->to('anand.pandey@demolink.com');//$arr[0]->seeker_email

        $this->email->subject($subject);
        $this->email->message($msgdata);

        if ($this->email->send()) {
            echo 1;
            exit();
        } else {
            echo $this->email->print_debugger();
        }

    }
...