如何将此更新查询写入codeigniter?

时间:2016-10-17 07:35:44

标签: php sql codeigniter

查询:

    $sql = "UPDATE sports SET status = 0 WHERE sport_id NOT IN (".$sport_id.") and user_id='".$user_id."'";

1 个答案:

答案 0 :(得分:1)

试试这个,它适合你...

$this->db->where_not_in('sport_id', explode(",",$sport_id));
$this->db->where('user_id', $user_id);
$this->db->update("sports", array("status" => 0));