Drupal pager won't work with "LIKE" in the query
I can't get this to work when using a query with LIKE
. Example:
$sql = " SELECT DISTINCT u.uid, u.name, u.status, u.created, u.access FROM d_bi_test_2_shared.users u LEFT JOIN d_bi_test_2.users_roles ur ON u.uid = u开发者_JS百科r.uid WHERE u.uid != 0 AND LOWER(u.name) LIKE LOWER('%%er%%') ";
$sqlCount = " SELECT COUNT(*) FROM d_bi_test_2_shared.users u LEFT JOIN d_bi_test_2.users_roles ur ON u.uid = ur.uid WHERE u.uid != 0 AND LOWER(u.name) LIKE LOWER('%%er%%') ";
$count = 3;
$query = pager_query($sql, 5, 0, $sqlCount);
$output.=theme('pager', $count);
This gives me no pager at all. If I take out the LIKE
it works, but I need to search like that for my form.
try CONCAT('%%',LOWER(er),'%%')
精彩评论