[英]Not equal to condition in mysql query codeigniter
This My Model Code: 这个我的模型代码:
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();
}
How could I select only non zero values from the field Something? 我怎样才能从字段中选择非零值? Above query is not working.
以上查询无效。
Try this : 尝试这个 :
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();
}
Try this 尝试这个
We can use simply way to find out the not equal value from the codeigniter mysqli query: 我们可以使用简单的方法从codeigniter mysqli查询中找出不相等的值:
$this->db->where('tbl_tabel_name != ', $id_name); //correct way
This will works sweetly too: 这也会很有效:
<?php
$my_query = $this->db->get_where('my_table' , array(
'table_row!='=> NULL
))->result_array();
?>
Enjoy :) 请享用 :)
也完成了
$this->db->where('columnName !=','string');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.