Next Tutorial

Drupal 7 Tutorial Part 16: Drupal 7 Reports & Logs Explained

Drupal theme pager not working

Submitted by anilsagar on Wed, 05/26/2010 - 17:55

Hi ,

Today i found one strange bug with drupal 6 pager_query implementation. When i write part of sql query in small letters like

$result = pager_query("SELECT * from {table1} where placementid = %d", 10, $pager_num, NULL, $vid);

and calling theme('pager', NULL, 10, $pager_num); pager is failed to print.

But writing like this

$result = pager_query("SELECT * FROM {table1} where placementid = %d", 10, $pager_num, NULL, $vid);

and calling theme('pager', NULL, 10, $pager_num); pager is displayed. This is due to case sensitivity of "FROM" in sql query.

Cheers,
Anil Sagar

3 comments

pretty weird but true!

Submitted by Anonymous on Wed, 08/11/2010 - 04:17.

That's true, that happens to me also, I placed FROM in capital letters and the pager worked, with lowletters it did not create the page.

Awesome thanks for the tip :),
Luis

capital letter worked for me also

Submitted by Anonymous on Thu, 12/15/2011 - 16:45.

capital letter worked for me also, I have to capitalized SELECT FROM and WHERE then pager appears

I had found something like

Submitted by Anonymous on Mon, 05/31/2010 - 23:03.

I had found something like that..But we may not be able to call that a bug...

$result = pager_query(" SELECT * from {table1} where placementid = %d", 10, $pager_num, NULL, $vid);

This will also not print. Ever wonder why? Look for space before SELECT..

Since it uses pattern matching, this is an issue.. Hope this helps some one...

Thanks
Vikram Y

©2010 AnilSagar. All rights reserved. Drupal theme by Kiwi Themes.