0

I have following code:

$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');

I want to pass the $data['dd] to view. What currently I am receving is only first value. Help me for this

1 Answer 1

1

You are replacing $data['dd'] value. every time foreach loop runs it will replace with new value. Instead do like this

$data['dd'][] = $this->dbop->customquery("SELECT *  FROM os 
  where userid='".$value->id."'");
Sign up to request clarification or add additional context in comments.

3 Comments

i had done the way use said but now its now showing anything in view @AnilShrestha
what does anything mean. you should use foreach to echo its values since it is an array
opps there was my mistakes. You method works out..Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.