from('foo', '*');$select->where('ba"/> from('foo', '*');$select->where('ba">

Home >Backend Development >PHP Tutorial >急求php中 select的有关问题

急求php中 select的有关问题

WBOY
WBOYOriginal
2016-06-13 10:21:01802browse

急求php中 select的问题
//
// SELECT *
// FROM foo
// WHERE bar = "baz"
// OR id IN("1", "2", "3")
//
$select->from('foo', '*');
$select->where('bar = ?', 'baz');
$select->orWhere('id IN(?)', array(1, 2, 3);
上面的案例只是实现或的条件 ,
可是我要求实现 与最后一个条件是或的关系。如 select I from foo where bar ="baz" or (id=3 or id=4)
用$select->from('foo', '*');这样的方法怎么写?

------解决方案--------------------
再多写一个orwhere啊
------解决方案--------------------
也可以把where条件都写到一个$select->where();里面

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn