在codeigniter中清除mysql查询

时间:2015-05-19 04:04:05

标签: php mysql codeigniter

我想在codeigniter中实现这个mysql语句

$this->db->where('id', 30);
$this->db->update('sample_table', array('user_name'=>'John'));

// this line 

$this->db->where('sample_table_id', 30);
$this->db->update('sample_table_revision', array('user_name'=>'John'));

如何在此行清除查询?

2 个答案:

答案 0 :(得分:5)

尝试

$this->db->reset_query()

here

了解详情

答案 1 :(得分:0)

您也可以在第三个参数中传递where条件数组,如

$this->db->update('sample_table_revision', 
                     array('user_name'=>'John'), 
                          array('sample_table_id'=>30));