![]() |
HMVC and db - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: HMVC and db (/showthread.php?tid=51893) |
HMVC and db - El Forum - 05-22-2012 [eluser]riskk[/eluser] I installed the codeigniter HMVC plugin and it's working fine for me but when I try to load method of module from other module I get the error Here is my code: Module billet: Code: class getcombo extends CI_Controller { Module journal: Code: class journal extends MY_Controller { And error Code: A PHP Error was encountered The problem occur when I use Code: table_id = $this->db->select('table_id')->from('sys_tables')->where('table', 1)->get()->row()->table_id; How to fix this problem. HMVC and db - El Forum - 05-22-2012 [eluser]weboap[/eluser] try Code: return modules::run(billet/getcombo/semester); and btw parent :: StartAdmin();?????? HMVC and db - El Forum - 05-22-2012 [eluser]riskk[/eluser] same error return modules::run(billet/getcombo/semester); The problem occur when I use select to DB parent :: StartAdmin() is method of base controller. HMVC and db - El Forum - 05-22-2012 [eluser]weboap[/eluser] sorry! that was not related. when you place Code: table_id = $this->db->select('table_id')->from('sys_tables')->where('table', 1)->get()->row()->table_id; HMVC and db - El Forum - 05-22-2012 [eluser]qpixo[/eluser] [quote author="riskk" date="1337688069"]I installed the codeigniter HMVC plugin and it's working fine for me but when I try to load method of module from other module I get the error Here is my code: Module billet: Code: class getcombo extends CI_Controller { Module journal: Code: class journal extends MY_Controller { And error Code: A PHP Error was encountered The problem occur when I use Code: table_id = $this->db->select('table_id')->from('sys_tables')->where('table', 1)->get()->row()->table_id; How to fix this problem.[/quote] Why did you do a request DB in a Controller? Any reasons? You're not applied the basic concept of MVC here... Secondly with HMVC when calling others modules, you should only use modules::run(); HMVC and db - El Forum - 05-22-2012 [eluser]weboap[/eluser] also , if you are using the HMVC extension your controllers should be extended to MX_Controller unless you have a common class in MY_Cntroller and your controllers extended to it and it been extended in turn to MX_Controller. HMVC and db - El Forum - 05-22-2012 [eluser]InsiteFX[/eluser] Code: parent :: StartAdmin(); HMVC and db - El Forum - 05-22-2012 [eluser]riskk[/eluser] [quote author="weboap" date="1337715775"]also , if you are using the HMVC extension your controllers should be extended to MX_Controller unless you have a common class in MY_Cntroller and your controllers extended to it and it been extended in turn to MX_Controller.[/quote] Thank you!!! The problem was with the MX_Controller. |