Han*_*raf 6 php mysql codeigniter
这个我的模型代码:
public function select($id)
{
$this->db->select('Something');
$this->db->from('tbl_somthing');
$this->db->where('tbl_somthing.User_id',$id);
$this->db->where('tbl_somthing.Something',0,FALSE);
$query = $this->db->get();
return $query->result();
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能从字段中选择非零值?以上查询无效.
Moh*_*han 15
试试这个 :
public function select($id){
return $this->db->select('Something');
->from('tbl_somthing');
->where('tbl_somthing.User_id',$id);
->where('tbl_somthing.Something != ',0,FALSE);
->get()->result();
}
Run Code Online (Sandbox Code Playgroud)