$data = array ( |
'title' => $title , |
'name' => $name , |
'date' => $date |
); |
$this ->db->where( 'id' , $id ); |
$this ->db->update( 'mytable' , $data ); |
// 生成: UPDATE mytable SET title = '{$title}', name = '{$name}', date = '{$date}' WHERE id = $id |
/* |
class Myclass { |
var $title = 'My Title'; |
var $content = 'My Content'; |
var $date = 'My Date'; |
} |
*/ |
$object = new Myclass; |
$this ->db->where( 'id' , $id ); |
$this ->db->update( 'mytable' , $object ); |
// 生成: UPDATE mytable SET title = '{$title}', name = '{$name}', date = '{$date}' WHERE id = $id |