Thanks for your answer DEV03-ROMAIN, I already tried with with something else than
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.