Welcome Guest, Not a member yet? Register   Sign In
Query not showing all the rows
#3

Thanks for your answer DEV03-ROMAIN, I already tried with with something else than
Code:
num_rows()

but it's the same result

there is the full code:
Model
Code:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
date_default_timezone_set("UTC");

class History_model extends CI_Model {
    public function get_logs(){
        $query = $this->db->query("SELECT id,date_register FROM log_event ORDER BY id DESC");
        $total = $query->num_rows();

        $json  = array("total_logs"=>$total);            
        foreach ($query->result_array() as $row){                
            $json["datails"][] = array("id"=>$row["id"],"date"=>date_format(date_create($row['date_register']),"d/m/Y H:i:s"));
        }
        return $json;
    }
}

and this is the controller
Code:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');


class Jsondata extends CI_Controller {
    public function logs(){
        echo json_encode($this->history_model->get_logs());
    }
}

I know there is an error, be cause I can see only 72 rows, and I already check the db, the data is there.
Reply


Messages In This Thread
Query not showing all the rows - by gepd - 09-22-2015, 10:57 PM
RE: Query not showing all the rows - by gepd - 09-23-2015, 11:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB