Search code examples
phpcodeigniter-2

Codeigniter not returning all the rows from the database


Sorry if any of you find this question a dumb one.

Here's my problem:

I'm trying to retrieve all data from my database using the following query:

$this->db->where('chart_module', 'leads');
$query = $this->db->get('vtiger_charts')->result_array();

but I have no luck. I tried selecting just one field and get the result using result() but also didn't work. The only thing that works is row_array() but I can only get one record from that.

here's my controller code:

    $charts= $this->charts->get_leads();
    $this->load->view('home',$charts);

here's my view:

<?php
    echo $chart_series; // to test if I'm only getting a string. 

    foreach ($chart_series as $series){ //to test if I can get an array
        echo $series;
    }
?>

Thanks in advance.


Solution

  • Problem solved. $data['result'] = $this->charts->get_leads(); in controller.