I am working on codeigniter php framework. I have three category in the database namely :
Now I want to use these three categories in WHERE clause in single function. For that I wrote some of those query, but none of this work:
The column name is category_name and values are above mentioned
$this->db->where('category_name','category_name1');
$this->db->or_where('category_name','category_name2');
$this->db->where('category_name','category_name1' or 'category_name2');
Now how can I use this?
UPDATED: try it this way
$this->db->where('category_name', $category_name1);
$this->db->or_where('category_name', $category_name2);
or
$this->db->where_in('category_name', $category_name1, $category_name2);
您可以使用where_in,如下所示:
$this->db->where_in('category_name', array($category_name1, $category_name2));
尝试这个
$this->db->where('category_name',$category_name1)->where('category_name ',$category_name2)->where('category_name ',$category_name3);
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.