![]() |
Can i pass two database table in the model to the controller to the view? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Can i pass two database table in the model to the controller to the view? (/showthread.php?tid=51965) |
Can i pass two database table in the model to the controller to the view? - El Forum - 05-24-2012 [eluser]jeanel16[/eluser] I have two tables the names are menudb and msgdb, I want to select all from menudb, and also select all from msgdb then display the two table on the inboxmsgview.php I dont know how to pass two variables in the view and i know this code can not be correct no matter what i do $this->load->view('inboxmsgview', $data, $data1); is it possible to pass two tables? Can i pass two database table in the model to the controller to the view? - El Forum - 05-24-2012 [eluser]Abel A.[/eluser] Maybe with objects? I don't know if the view supports objects, but worth a try. Can i pass two database table in the model to the controller to the view? - El Forum - 05-24-2012 [eluser]dnc[/eluser] It sounds like you will be returning arrays from both tables, right? After both arrays are populated I would do this like: Code: $final_data = array_merge($data, $data1); Can i pass two database table in the model to the controller to the view? - El Forum - 05-25-2012 [eluser]kanjimaster[/eluser] Remember that $data is just an associative array whose indexes will end up as variables in the view so you can simply do this Code: ... and you'll have two variables $menu and $inbox waiting for you in the view. It's quite normal to pass lots of variables this way. Can i pass two database table in the model to the controller to the view? - El Forum - 05-27-2012 [eluser]jeanel16[/eluser] thanks for the replies, this topic was solved at "Help is this a bug" forum folder ![]() |