Welcome Guest, Not a member yet? Register   Sign In
Empty database output within CI
#1

[eluser]den-javamaniac[/eluser]
Hi. I'm building a simple app (using video tutorials and reference documentation) and trying to test DB result output. But unfortunately all I'm getting is an array of size 0. Here's the controller code excerpt:

Code:
$data['query'] = $this->db->query('SELECT role_id, role_privilege FROM role');
$this->load->view('welcome_message', $data);
And a view code excerpt:
Code:
<?php
        echo count($query->result_array())."<br/>";
        foreach ($query->result() as $row){
            echo $row->role_id . '<br/>';
            echo $row->role_privilege . '<br/>';
        }
        echo 'Total result '.$query->num_rows();
    ?&gt;
And what I get is next:

Code:
0
Total result
Running query from a command line gives a 2 rowed output as it's supposed to be. Can someone point out what I'm missing or where might be a problem?


Messages In This Thread
Empty database output within CI - by El Forum - 05-08-2010, 07:15 AM
Empty database output within CI - by El Forum - 05-08-2010, 08:43 AM
Empty database output within CI - by El Forum - 05-08-2010, 02:09 PM
Empty database output within CI - by El Forum - 05-08-2010, 02:41 PM
Empty database output within CI - by El Forum - 05-08-2010, 02:53 PM
Empty database output within CI - by El Forum - 05-08-2010, 03:33 PM
Empty database output within CI - by El Forum - 05-08-2010, 04:02 PM



Theme © iAndrew 2016 - Forum software by © MyBB