[![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