本文整理汇总了PHP中Tool::getLikeList方法的典型用法代码示例。如果您正苦于以下问题:PHP Tool::getLikeList方法的具体用法?PHP Tool::getLikeList怎么用?PHP Tool::getLikeList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tool
的用法示例。
在下文中一共展示了Tool::getLikeList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchUsersTotal
private function fetchUsersTotal($filters = array())
{
$key = md5(print_r($filters, true));
if (!($data = $this->getData($this->query_md5 . '_total_' . $key))) {
foreach ($filters as $filter => $value) {
$where = (isset($where) ? $where . ' AND ' : ' AND ') . $filter . '="' . $value . '"';
}
$rs = DB::select('
SELECT COUNT(*) as total
FROM `user` AS `u`
WHERE CONCAT_WS(" ", u.login, u.email) LIKE(\'' . Tool::getLikeList($this->query) . '\')
' . (isset($where) ? $where : '') . '
');
$this->setData($this->query_md5 . '_total_', $data = $rs['data'][0]['total']);
}
return $data;
}
示例2: search
public static function search($page = false, $query = false)
{
$from = (!$page ? 0 : $page - 1) * Conf::get('QUESTION_PER_PAGE');
$max = $page === false ? 0 : Conf::get('QUESTION_PER_PAGE');
$rs = DB::select('
SELECT u.id, u.login, u.valided, u.male, u.email, u.zip
FROM `user` AS `u`
JOIN `user_result` AS `r` ON r.user_id=u.id
WHERE valided="1" ' . ($query ? ' AND u.login LIKE(\'' . Tool::getLikeList($query) . '\')' : '') . '
GROUP BY u.id
ORDER BY u.register_date DESC
', $from, $max);
$users = array();
foreach ($rs['data'] as $user) {
$users[] = new Model_User($user['id'], $user);
}
return $users;
}