• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
passing multiple values to a view

#1
[eluser]livewirerules[/eluser]
I am trying to return 2 values from my database and pass those to a view.

Im returning the values from the buy and sell tables
Model
Code:
function mine(){

    $mylists=$this->db->get('buy');

    if ($mylists->num_rows()>0){

        foreach ($mylists->result() as $a)
        {
            $data['res1'][]=$a;
        }
    }

    $mylists2=$this->db->get('sell');

    if ($mylists2->num_rows>0)
    {
        foreach ($mylists->result() as $b)
        {
            $data['res2'][]=$b;
        }
    }
  return $data;
}



Controller
Code:
function leads(){
    $this->load->model('listings');

    $data['list']=$this->member_functions->mine();
    $data['heading']='headings/heading_view';
    $data['body']='listbody';
    $data['nav']='right';

    $this->load->view('includes/template',$data);

}

My view
Code:
<h2>Buy Leads</h2>

//display all the buy leads from the table


<h2>Sell leads/h2>

//display all the sell leads from the table


The problem that im having is how can i separate the $data['list'] values as the buy and sell leads?



Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.