I'am using a CodeIgniter 2.1.x and MySQL.
I found a lot of advices between using mysql column type DATETIME
and TIMESTAMP
, but I'm not sure which is really correct to use with what I want to build.
I have an application, where user can add markers to google maps throught the <form></form>
.
After each marker submission, a current time should be recorded for the mysql's column date_created
and date_end
which should be +1day by using this function:
class Maps extends CI_Controller{
...
public function marker($action = NULL, $slug = 'marker_add'){
...
if($this->form_validation->run() == TRUE){
$tomorrow = now() + 86400;
$data_markers = array(
'tid' => $this->input->post('formMarkType'),
'lat' => $this->input->post('formMarkLat'),
'lng' => $this->input->post('formMarkLng'),
'state' => 1,
'description' => $this->input->post('formMarkDescription'),
'date_end' => $tomorrow
);
$this->map_model->markers_add($data_markers);
redirect(site_url());
}
...
}
}
But it never updates correctly when I'am using column types set as TIMESTAMP
or DATETIME
.
Any suggestion what I'm doing wrong here ?