如何使用codeigniter在单个视图页面中维护两个表数据

[![enter image description here][1]][1][enter image description here][2]I have two tables invoice and invoice_description, The column invoice_no is common for both tables, I want to fetch the data from invoice table name,address,invoice_no and next table invoice_description I want to fetch product description, quantity, price and more.
this is my table structure

                        invoice
         --------------------------------------
          name   bill_no   invoice_no   address    price
           adi     1        2           adasdasd     12
           abc     2        3           adasdas       13


                       invoice_description
        -----------------------------------------------------
               product   invoice_no  quantity 
                a          2          1
                b          2          2
                c          3          3

     i wana output like when i pass invoice_no 2
               invoice_no:-2     name- adi
                product          quantity
                 a                 1
                 b                 2

This is my controller:-

public function invoice($id)
{
            //echo $id;
        $this->load->database();  
             //load the model  
        $this->load->model('useradmin');  
            //$invoice=$this->useradmin->selectdealer($id);  
            //$invoicedes=$this->useradmin->selectdealer1($id);  
            //$data['invoice']=$invoice;
            //$data['invoicedes']=$invoicedes;
            //$this->load->view('envoice',$data);  
          //
        $query = $this->useradmin->selectdealer($id);
        $ids = $this->useradmin->selectdealer1($id);  
        $data['dealers'] =  $query;
        $data['id'] = $ids;                     
        $this->load->view('envoice',$data);
    }

}

My model is:-

public function selectdealer($id)  
{  
    //data is retrive from this query  
    //echo $id;           
    //$this->db->select('*');  
    //$this->db-from('invoice_description');
    $this->db->where('invoice_no', $id);
    $query = $this->db->get('invoice_description');
    return $query->result();
}   
public function selectdealer1($id)  
{  
    //data is retrive from this query  
    //echo $id;
    $query = $this->db->get('invoice');  
    $this->db->where('invoice_no', $id);
    return $query->result();    
}   

I want invoice no, name, and address from invoice table and more than one product description from invoice_description table

I m trying my view page is

invoice_no :-123 name:-xyzx

product des price quantity asdaf 12 10 asafsa 12 13

In controller

public function invoice($id)
{
    $this->load->database();  
    $this->load->model('useradmin');  
    $data['dealer'] = $this->useradmin->selectdealer($id);
    $this->load->view('envoice',$data);
}

In model

public function selectdealer($id)  
{  
    $this->db->select("name, address, invoice_no");
    $this->db->from('invoice');
    $this->db->where('invoice_no', $id);
    $result = $this->db->get()->row_array();
    return $result;
}   

In view

foreach($dealer as $row){
    echo $row['name'];
    echo $row['address'];

        $query = $this->db->get_where('invoice_description', array('invoice_no' => $row['invoice_no']));
$results = $query->result_array();
print_r($results);
    foreach($results as $desc){
        echo $desc['quantity'];
        echo $desc['price'];
        echo $desc['desc'];
    } 
}

In Controller

//Assign empty array $data and assign a results to the respective array
$data['invoice_description_data']= $this->useradmin->selectdealer($id);
$data['invoice_data'] = $this->useradmin->selectdealer1($id); 
$this->load->view('envoice',$data);     

In View

//call 
print_r($invoice_data);
print_r($invoice_description_data);
public function selectdealer($invoice_id) {
    $this->db->select('invoice.*, invoice_description.*')
                 ->from('invoice')
                 ->join('invoice_description', 'invoice.invoice_no = invoice_description.invoice_no');
    ->where ( "invoice.invoice_no='".$invoice_id."' ",'',FALSE );
    $query=$this->db->get();
    return $query->result();
}

use join to retrieve data from two table

foreach($row as $invoicedata){   
    display your data here
}
  public function selectdealer($id)  
  {           
     if(!empty($id))
     {
     $this->db->where('invoice_no', $id);
     $query = $this->db->get('invoice');
     return $query->result();     
     }
  }   

this work for invoice name correctly but error on this line

$query = $this->db->get_where('invoice_description', array('invoice_no' => $row['invoice_no']))->result_array();
print_r($query);
   public function selectdealer($id)  
    {  
     if(!empty($id))
         {
    $this->db->where('invoice_no', $id);
    $query = $this->db->get('invoice');
    return $query->result();  
         }
    }   
   public function selectdealer1($id)  
     {  

     if(!empty($id))
        {
            $this->db->where('invoice_no', $id);
         $query = $this->db->get('invoice_description');  
        return $query->result();  
     }  
  } 

those function works for me correctly thanku friends aap logo ko mare help karne kaye liye