![]() |
Undefined variable: query! - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Undefined variable: query! (/showthread.php?tid=16263) |
Undefined variable: query! - El Forum - 03-01-2009 [eluser]lkoreality[/eluser] I'm getting an undefined variable: data in my controller and an undefined variable: query in my view. My database should be loading automatically. This is the code in my view file that's causing the problem: Code: <? foreach ($query->result() as $sub): ?> I'm loading a model: Code: <?php to my controller. I'm using this code: Code: $this->load->model('Links'); I tried placing it both in the construct and a function of my controller. I'm loading the data file into a view file. Any ideas? Undefined variable: query! - El Forum - 03-01-2009 [eluser]pistolPete[/eluser] Are you passing any data to the view? I would use something like this: Links_model.php Code: class Links_model extends Model { Links.php Code: class Links extends Controller { some_view.php Code: <?php foreach ($query->result() as $sub) Undefined variable: query! - El Forum - 03-01-2009 [eluser]lkoreality[/eluser] I tried that but i've named the model links.php I'm getting an Code: Severity: Notice Undefined variable: query! - El Forum - 03-01-2009 [eluser]pistolPete[/eluser] Quote:My database should be loading automatically. But it is not, otherwise you wouldn't get the above error. Undefined variable: query! - El Forum - 03-01-2009 [eluser]lkoreality[/eluser] Ah! I was autoloading the core library not the libraries. Thanks! Undefined variable: query! - El Forum - 04-04-2009 [eluser]Zack Kitzmiller[/eluser] Wrong Topic, sorry. |