脚本宝典收集整理的这篇文章主要介绍了php – 在WHERE条件下使用BETWEEN,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
function gethotels($state_id,$cITy,$accommodation,$minvalue,$maxvalue,$limit,$pgoffset) { $this->db->limit($limit,$pgoffset); $this->db->order_by("id","desc"); $this->db->where('state_id',$state_id); $this->db->where('city',$city); // This one should become a between selector $this->db->where($accommodation,$minvalue); $result_hotels = $this->db->get('hotels'); return $result_hotels->result(); }
$this->db->where('$accommodation >=',minvalue); $this->db->where('$accommodation <=',maxvalue);
我不确定语法,所以如果不正确,请求赦免.
无论如何,BETWEEN使用> = min&&&& < =最大
这是我的例子的意思.
编辑:
看着this link我想你可以写:
$this->db->where("$accommodation BETWEEN $minvalue AND $maxvalue");
以上是脚本宝典为你收集整理的php – 在WHERE条件下使用BETWEEN全部内容,希望文章能够帮你解决php – 在WHERE条件下使用BETWEEN所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。