I cannot pull data with Codeigniter join command

26 Views Asked by At

In my current code, I want to match the data in the column named "model" in the "feed" table with the "model_id" column in the table named "arac_model", take the data in the "model" column in the same table and send it to the user as an e-mail in the mail code blog. But I couldn't pull the data.

        class Atama extends CI_Controller
{
public function index ()

    {
$feed = $this->db->where("islenme", 0)->get("feed")->result();

    

        $personeladet=array();

        foreach ($feed as $liste) {
            
        

      //  $sube=$this->db->where("form_id",$liste->form_id)->get("feed_sube")->row();
            

        $personeladet=array();

        $personel=$this->db->where("personel_isyeri",$liste->sube)->where("durum",1)->where("personel_departman",1)->get("personel")->result();

            print_r($personel);

                    

        foreach($personel as $adet){



             $kayitadet=$this->db->query("select * from is_emri where month(isemri_giris)=month(now()) and year(isemri_giris)=year(now()) and isemri_kullanici='".$adet->personel_id."'")->num_rows();



             $personeladet[$adet->personel_id]=$kayitadet;





            }

            asort($personeladet);



            $key1=array_key_first($personeladet);

        


        $url=md5($liste->musteri_tel.$key1.$feed->sube.$feed->model.date("Y-m-d H:i:s"));

        $array=array(
            'isemri_kullanici'=>$key1,
            'isemri_giris'=>date("Y-m-d H:i:s"),
            'durum'=>0,
            'isemri_aciklama'=>'',
            'isemri_arac'=>'0',
            'isemri_cikis'=>date("Y-m-d H:i:s"),
            'isemir_tamamlama'=>date("Y-m-d H:i:s"),
            'tamamlama_aciklama'=>'',
            'musteri_tel'=>$liste->musteri_tel,
            'musteri_ad'=>$liste->musteri_ad,
            'musteri_posta'=>$liste->musteri_eposta,
            'marka'=>$liste->marka,
            'model'=>$liste->model,
            'arac_isyeri'=>$liste->sube,
            'kanal'=>'1',
            'fiyat'=>0,
            
            'url'=>$url
        );
            
        //  print_r($array);

        $this->db->insert("is_emri",$array);
            
            
        
        $this->load->library("email");
               
            $this->email->from('[email protected]', 'Arkas Otomotiv '.$arac_model_data->model.'CRM');      

        //    $this->email->to(implode(', ', $array));
        
            $pe=$this->db->where("personel_id",$key1)->get("personel")->row();
            
            
        
            $mudur=$this->db->where("personel_isyeri",$pe->personel_isyeri)->where("personel_departman",2)->get("personel")->row()->eposta;
        
            
        
            
            //$this->email->to("[email protected]");
            
            $this->email->set_header('Importance', 'High');
            $this->email->set_header('X-MSMail-Priority', 'High');
            $this->email->set_header('X-MSMail-Priority', '1 (Highest)');
            
            $this->email->to($pe->eposta);
            $this->email->cc(array($mudur,"[email protected]"));

            $this->email->subject('Crm - Arkasotomotiv ');

            $text='<h3>Arkas Otomotiv '.$liste->model.' Leads </h3><br>';
            $text.="Oluşturma: ".date('Y-m-d H:i:s')."<br>";
            $text.="Müşteri Adı:".$liste->musteri_ad."<br>";
            $text.="Müşteri Telefon:".$liste->musteri_tel."<br>";
            $text.="Müşteri adayı ile görüştükten sonra sonucunu işlemek için linki tıklayın.<br>";
            
            
            
            $text.="<a href='https://crm.egeinternet.com/leads/goster/?key=".$url."'>Talebi işle</a><br>";
            
        
            $this->email->message($text);
            
            $this->email->send();
            print_r($this->email->print_debugger());
            
            

       $guncelle=array("islenme"=>1);
         $this->db->where('feed_id',$liste->feed_id);
       $this->db->update("feed",$guncelle);


        }


    }

}
0

There are 0 best solutions below