What am I doing wrong? DB, select, array - 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: What am I doing wrong? DB, select, array (/showthread.php?tid=59302) |
What am I doing wrong? DB, select, array - El Forum - 09-18-2013 [eluser]ZioN[/eluser] I want to pass information from a database table to a view, but I cannot get it to pass over the result. Controller (acp): Code: public function get_users(){ Model (users_model): Code: public function get_users_model(){ A print_r (to test if the $data contains variables) on the model works, but it will not give the data back to the controller and thus not to the view. What am I doing wrong? DB, select, array - El Forum - 09-18-2013 [eluser]mejlo[/eluser] replace Code: if ($this->users_model->get_users_model()){ Code: if ($data = $this->users_model->get_users_model()){ What am I doing wrong? DB, select, array - El Forum - 09-18-2013 [eluser]ZioN[/eluser] Almost perfect. I tried sending it to the view but it does not recognize it. Controller: Code: public function get_users(){ Code: public function get_users_model(){ Error: Code: A PHP Error was encountered What am I doing wrong? DB, select, array - El Forum - 09-18-2013 [eluser]mejlo[/eluser] try: Code: $this->load->view('acp/manage_users_view', array('data' => $data)); What am I doing wrong? DB, select, array - El Forum - 09-18-2013 [eluser]ZioN[/eluser] That fixed it. Thanks! |