2

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 = ur.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.

EricP
  • 1,459
  • 6
  • 33
  • 55
  • 1
    Did you run the query in MySQL itself, whithout going trough Drupal? When you did that, did the qeury return any results? It seems you misunderstand the %; you probably only want one %, like `(%er%)`. – berkes Aug 11 '11 at 12:10
  • Does it work if you remove the `DISTINCT`? – ypercubeᵀᴹ Jan 21 '12 at 21:43

1 Answers1

0

try CONCAT('%%',LOWER(er),'%%')

jmc734
  • 315
  • 3
  • 3