CodeIgniter:如何使用WHERE子句和OR子句 [英] CodeIgniter: How to use WHERE clause and OR clause
本文介绍了CodeIgniter:如何使用WHERE子句和OR子句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用以下代码从带有Code Igniter webapp的MySQL数据库中选择:
I am using the following code to select from a MySQL database with a Code Igniter webapp:
$query = $this->db->get_where('mytable',array('id'=>10));
这很棒!但是我想使用CI库编写以下MySQL语句?
This works great! But I want to write the following MySQL statement using the CI library?
SELECT * FROM `mytable` WHERE `id`='10' OR `field`='value'
谢谢!
推荐答案
$where = "name='Joe' AND status='boss' OR status='active'";
$this->db->where($where);
这篇关于CodeIgniter:如何使用WHERE子句和OR子句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文