CodeIgniter Forums
Codeigniter multi table model - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 2.x (https://forum.codeigniter.com/forumdisplay.php?fid=18)
+--- Thread: Codeigniter multi table model (/showthread.php?tid=85913)



Codeigniter multi table model - JamesHimmerla - 12-20-2022

So im kinda lost at this moment. i use codeigniter 2.x and i stucked at last view i need to do .

One thing that sets this view apart from others is that it needs data from 6 deferent tables. How do i do this ?


RE: Codeigniter multi table model - JustJohnQ - 12-21-2022

If the view will contain a combination of the 6 tables you will need to join the tables in your model using SQL join.
If your view contains separate data from the six tables, you would call the respective queries in your model 6 times,

PHP Code:
$data['query1result'] = $this->model->getQuery1();
$data['query2result'] = $this->model->getQuery2(); 

etc.