简体   繁体   中英

How can i write this update query into codeigniter?

询问:

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

Try this it's works for you...

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM