代码之家  ›  专栏  ›  技术社区  ›  Mohammed Sabir

如何在codeigniter中将会话变量的值传递给foreach循环中的视图

  •  0
  • Mohammed Sabir  · 技术社区  · 8 年前

    我有以下代码:

    $m1 =  $this->dbop->customquery('SELECT DISTINCT number FROM users');
        $message =''; $email='';            
    
        $count=array();
        foreach($m1 as $item){
                $message='';
         $count=array();
            $m2 =  $this->dbop->customquery("SELECT *  FROM users where 
           number='".$item->number."'");
            foreach ($m2 as $value) {
                //$data['alldata'] = $value;
             $count[] =  $this->dbop->customquery("SELECT *  FROM 
         s_data where userid='".$value->id."'");
             $os_count =  $this->dbop->customquery("SELECT *  FROM 
           os where userid='".$value->id."'");
            $data['dd']=$this->dbop->customquery("SELECT *  FROM os 
          where userid='".$value->id."'");
            }
    
    
        }
    
        $data['username'] = $this->session->userdata('username');
    
        $this->load->view('header-inside', $data);      
        $this->load->view('am-report' , $data);
        $this->load->view('crm/footer-inside');
    

    我想通过考试 $data['dd] 查看。 帮我个忙

    1 回复  |  直到 8 年前
        1
  •  1
  •   Anil Shrestha    8 年前

    $data['dd'][] = $this->dbop->customquery("SELECT *  FROM os 
      where userid='".$value->id."'");