[eluser]reghan[/eluser]
I am unsure how to update my 'DateCompeted' field with the current timestamp, when a user submits and update in a form:
Here is my code:
Code:
$id = $this->uri->segment(3);
$dept_info = $this->department_model->get_by_id($id);
$data['department'] = $dept_info->result();
$data['action'] = site_url('bia/addRes/' . $id);
$data['link_back'] = anchor(base_url(),'Back to list of departments',array('class'=>'back'));
$datecomp = now();
$res = array('DepartmentName' => $this->input->post('dpt_name'),
'DateCompleted' => $datecomp);
$this->department_model->updateResponder($id,$res);
model
Code:
function updateResponder($id, $res)
{
$this->db->where('DepartmentId', $id);
$this->db->update('department', $res);
}
using the above code gives me this error:
Error Number: 1292
Incorrect datetime value: '1340288274' for column 'DateCompleted' at row 1
UPDATE `department` SET `DepartmentName` = 'reghan', `DateCompleted` = 1340288274 WHERE `DepartmentId` = '6'
Filename: C:\wamp\www\igniter\system\database\DB_driver.php
Line Number: 330
I am not really sure what to do at this point. I would like the datetime updated every time the user saves the form.
Hope this helps! thanks in advance!!