I need help, I have 2 tables Client and Product. I want to fetch data from Product Table on basis of Client Table and show it as whole.
productTable
productId productName productPrice
1 Abc 100
2 Bcd 200
3 Cde 300
clientTable
clientId productNameId clientName
4 2 A
5 3 B
6 1 C
I want the table to show the record as:
Client Name Product Name
A Bcd
B Cde
C Abc
How can I show them using MVC CI.
Model
class Client_model extends CI_model
{
function All()
{
return $client = $this->db->get('client')->result_array();
}
}
Controller
class Client extends CI_Controller
public function index()
{
$this->load->model('Client_model');
$invoice = $this->Client_model->All();
$data = array();
$data['client'] = $client;
$this->load->view('admin/ViewClient', $data);
}
}