[eluser]杨帅[/eluser]
i use the following code to update a record in my database, but i want to use the mysql now() function in the config variable $data, the following syntaz output error, cuz php thought now() is a php function, and it cannot find it. if i surround quotes on now() as
Code:
'last_edit_time'=>'now()';
it also output error, cuz mysql thought "now()" is a string ,and it cannot be insert into a datetime collum in the database. anyone know how to solve this problem?
Code:
$data=array(
'name'=>$name,
'sex'=>$sex,
'work_experience'=>$work_experience,
'last_edit_time'=>now();
);
$username=$this->session->userdata('username');
$this->db->where('username', $username);
$this->db->update('person', $data);