I have fields in a table that are being constantly updated with the current time (each second). First, the controller calls a function to create the record in the database
public function saveEntry($theuser='')
{
$data = array(
'theuser' => $theuser ,
'dateentered' => date('Y-m-d') , //date('d-m-Y H:i:s') ,
'gname' => date('d-m-Y H:i:s') ,
'ldate' => date('Y-m-d'),
'ltime' => date('H:i:s'),
'ldatetime' => date('Y-m-d H:i:s')
);
$this->db->insert('onlineusers', $data);
}
Then, after the view is called, an ajax function keeps updating the time on the database.
The problem is that when ajax updates the database (with a simple .php update page), the time is less 10 or so minuts than when Codeigniter's function created the record. The difference bettwen CodeIgniter and a simple .php file is, always, more or less 10 minuts
What could I be doing wrong? Is there a way to sincronize the two? Or some other way possible to solve the problem?
My thanks in advanced