Welcome Guest, Not a member yet? Register   Sign In
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?





Theme © iAndrew 2016 - Forum software by © MyBB