[eluser]2think[/eluser]
Hi everyone, I'm new to Code Igniter and come from a C/Java background. I tried doing some simple db stuff and I think I need a conceptual understanding or pseudo-code if possible. I can load a Controller and echo a table (customers) like this(using CI example):
class Allusers extends Controller {
function index()
{
$query = $this->db->query('SELECT name, title, email FROM my_table');
foreach ($query->result() as $row)
{
echo $row->title;
echo $row->name;
echo $row->email;
}
echo 'Total Results: ' . $query->num_rows();
However, if I try to pass either $query or $row to the View, it doesn't display anything and throws errors about it being a non-object.
I think I really need to understand what I should be passing to the View to echo there instead of the Controller? I do understand MVC but guess not well enough!
I'd ideally like to understand how to pass (and what to pass) objects/variables from my Models to my Controllers then to my Views.
Thanks in advance for any help.