Zend where or怎么传

Zend framework 1 中使用数据库查询时 where条件总是感觉不知道如何传

 比如如下sql:

select t.* from t where a=1 and (b=2 or c=3)

 代码应该写成如下:

        $select->from('t');
        $select->where('a =?','1');
        $select->where(' b = 2 OR c = 3');

如果代码写成如下方式:

        $select->from('t');
        $select->where('a =?','1');
        $select->orWhere(' b = ?',2);
        $select->orWhere(' c = ?',3);

 打印出sql为:

select t.* from t where a=1 or b=2 or c=3;

猜你喜欢

转载自www.cnblogs.com/kala00k/p/13125438.html