Fatal error: Call to undefined method CI_Loader::result()

#3
[eluser]Jamie Rumbelow[/eluser]
Hello Rick,

Firstly, welcome to the CodeIgniter community!

You're trying to call result() on the CI master object - which is definitely not a good idea. result() is a method given to you by the DB result object, which is returned by $this->db->get() or $this->db->query(). In your controller, you assigned the result object to $data['query'], so in the view it's available as $query.

Knowing this, we just have to change the foreach loop in your view and it all should work:

Code:
<?php foreach($query->result() as $row): ?>

When in doubt, read the user manual - it's very comprehensive. Hope this has helped.

Jamie


Messages In This Thread
Fatal error: Call to undefined method CI_Loader::result() - by El Forum - 01-10-2010, 06:02 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.