Welcome Guest, Not a member yet? Register   Sign In
using mysql function in update function's config virable
#1

[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);


Messages In This Thread
using mysql function in update function's config virable - by El Forum - 09-04-2007, 03:22 PM



Theme © iAndrew 2016 - Forum software by © MyBB