【发布时间】:2013-04-05 09:49:34
【问题描述】:
我有一个函数根据传递的参数返回数据。 基本上,查询会根据子句而变化。
if(1==$case)
return select()->from('db')->where('x',$something)->where('y','fixed')...
else if(2==$case)
return select()->from('db')->where('x','fixed')->where('y',$something)...
有没有更好的方法来做到这一点?
还有,有没有可能有这样的条款
...->where('category',*)
'*' 被一个值或等同于“any”的东西替换。
【问题讨论】:
标签: php codeigniter activerecord