杭州神话信息技术有限公司
标题:
建议记事狗修改下这个函数
[打印本页]
作者:
xfteacher
时间:
2010-11-25 22:42:18
标题:
建议记事狗修改下这个函数
函数build_like_query($fields,$keywords,$binary=false)
$keywords='('.implode(') or (',$keywords_list).')'
复制代码
修改为(即前后加上括号):
$keywords='(('.implode(') or (',$keywords_list).'))'
复制代码
理由:以使其匹配后面可能有的逻辑与关系。
$where_list['keyword'] = build_like_query('province,city',$mapaddress);
$where_list['checked'] = "checked = '1'";
$where = (empty($where_list)) ? null : ' WHERE '.implode(' AND ',$where_list).' ';
复制代码
匹配的是:
$where = " where `province` like '%".$mapaddress."%' or `city` like '%".$mapaddress."%' and `checked` = '1' ";
复制代码
而不是:
$where = " where (`province` like '%".$mapaddress."%' or `city` like '%".$mapaddress."%') and `checked` = '1' ";
复制代码
作者:
76844
时间:
2010-11-26 00:18:25
修改前和修改后的区别是?
这样的好处是?
不懂PHP的路过
请楼主指教.谢谢.
欢迎光临 杭州神话信息技术有限公司 (http://cenwor.com/)
Powered by Discuz! X2