ar中如何让字段自加一呢
我想让登录次数加一,如下好像不行,应是怎么用?$this->db->set('lastupdate',now());
$this->db->set('loginnum','loginnum+1');
$this->db->where('adminname',$username);
$this->db->update('admin'); 解决了
$this->db->set('loginnum','loginnum+1',FALSE); set() will also accept an optional third parameter ($escape), that will prevent data from being escaped if set to FALSE. To illustrate the difference, here is set() used both with and without the escape parameter.
$this->db->set('field', 'field+1', FALSE);
$this->db->insert('mytable');
// gives INSERT INTO mytable (field) VALUES (field+1)
$this->db->set('field', 'field+1');
$this->db->insert('mytable');
// gives INSERT INTO mytable (field) VALUES ('field+1')
页:
[1]