【发布时间】:2015-01-10 08:11:36
【问题描述】:
我想像这样在fuelphp的sql中使用“()”。
select * from shop where (item1=$item1 or item2=$item1) and flag=on;
我试着这样表达;
$shop_query = DB::select()->from('shop');
$shop_query->where(function($shop_query){
$shop_query->where('item1','=',$item1)
->or_where('item2','=',$item1);
$shop_query ->and_where('flag','=','on');
但是,这显示错误:undefined index item1.$item1,而且肯定有值。
我该如何解决这个问题?
【问题讨论】: