Problem passing variables to view - 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: Problem passing variables to view (/showthread.php?tid=20163) |
Problem passing variables to view - El Forum - 06-30-2009 [eluser]Unknown[/eluser] Hi. I am trying to do a simple exercise where I get information out of a database and print it in my view. The following code works without a problem: Code: <?php However, when I try the following: Code: <?php along with: Code: <html> I think I am doing the right thing; the documentation says to send an array of objects to the view, so I am turning $data into an array of objects before I send it. However, I get the following errors: Quote:A PHP Error was encountered and, Quote:A PHP Error was encountered Do you guys know what I'm doing wrong? Thanks!! Problem passing variables to view - El Forum - 06-30-2009 [eluser]Marcelo Lipienski[/eluser] Try this Your controller Code: $data['query'] = $this->db->get('your_table'); Your view Code: if ($query->num_rows() > 0) { |