![]() |
Problem with $this->load->vars - 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: Problem with $this->load->vars (/showthread.php?tid=17602) |
Problem with $this->load->vars - El Forum - 04-09-2009 [eluser]RJ[/eluser] Hello, I'm trying to utilize the $this->load->vars method to enable use of vars in the view. Below in a Model I am first grabbing all db data for a specific dealer, then adding to session(probably remove that eventually), then trying to make those variables returned to database usable in my views. Code: if (isset($dealer) && $dealer !='') And here is my grab_vars method Code: function grab_vars($dealer) and this is what my array looks like Code: Array Loading those vars does not make them usable in a view. Any suggestions? Problem with $this->load->vars - El Forum - 04-09-2009 [eluser]TheFuzzy0ne[/eluser] You need to pass back the row_array() if you're only expecting a single row to be returned, or load your vars like this: Code: $this->load->vars($this->vars[0]); Problem with $this->load->vars - El Forum - 04-09-2009 [eluser]RJ[/eluser] Thanks @TheFuzzy0ne! So any time i expect only a single row return, use row_array(). Thank you Problem with $this->load->vars - El Forum - 04-09-2009 [eluser]TheFuzzy0ne[/eluser] Something like that yes. Basically, row_array will return the topmost row in your results, even if more than one row was retrieved. |