Closed (duplicate)
Project:
Drupal core
Version:
6.1
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
6 Mar 2008 at 19:55 UTC
Updated:
21 May 2008 at 20:42 UTC
1) Create a pager query using printf() syntax for the select_expr:
pager_query('SELECT %s FROM {%s}', 5, 0, NULL, $myexpression, $mytable)
The COUNT() query in pager_query shifts all the printf() arguments over by one place. Results in standard MySQL syntax error message: "user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use..."
The COUNT() query would successfully use printf() on the entire query.
The COUNT query is not created with printf() in mind for the select_expr:
pager.inc
65: $count_query = preg_replace(array('/SELECT.*?FROM /As', '/ORDER BY .*/'), array('SELECT COUNT(*) FROM ', ''), $query);
Comments
Comment #1
chx commentedProvide your own count_query if you are doing weird stuff.
Comment #2
deekayen commentedhttp://drupal.org/node/211925