user warning: The used SELECT statements have a different number of columns query: SELECT COUNT(*) FROM drupal_node n INNER JOIN drupal_users u ON n.uid = u.uid AND u.uid = 1 UNION SELECT c.cid, c.nid, c.subject AS title, c.comment, n.type, u.name AS username, u.uid, c.status, c.timestamp AS created, 0 AS changed FROM drupal_comments c INNER JOIN drupal_node n ON c.nid = n.nid INNER JOIN drupal_users u ON u.uid = c.uid AND u.uid = 1

in return pager_query

line: isset($_SESSION['cmf_max_rows']) ? $_SESSION['cmf_max_rows'] : 50, 0, NULL, $args);

Comments

jannalexx’s picture

Title: error when selecting "both" » when selecting "both" user warning: The used SELECT statements ... on line 498

results are ok but:

user warning: The used SELECT statements have a different number of columns query: SELECT COUNT(*) FROM drupal_node n INNER JOIN drupal_users u ON n.uid = u.uid AND u.uid = 1 UNION SELECT c.cid, c.nid, c.subject AS title, c.comment, n.type, u.name AS username, u.uid, c.status, c.timestamp AS created, 0 AS changed FROM drupal_comments c INNER JOIN drupal_node n ON c.nid = n.nid INNER JOIN drupal_users u ON u.uid = c.uid AND u.uid = 1 in /.../sites/all/modules/cmf/cmf.module on line 498.

nancydru’s picture

You are going to have to provide a count query. This seems to do the trick:

      $count_query = 'SELECT COUNT(*) FROM {node} n'
        .' INNER JOIN {users} u ON n.uid = u.uid '
        . $filter['join']
        . $filter['where'] 
        .' UNION SELECT COUNT(*) FROM {comments} c INNER JOIN {node} n ON c.nid = n.nid '
        .' INNER JOIN {users} u ON u.uid = c.uid '
        . $filter['join']
        . $filter['where'];

And, of course, the pager_query needs to specify this.

nancydru’s picture

Status: Active » Needs review
nancydru’s picture

nancydru’s picture

Status: Needs review » Fixed

Committed to both -dev versions.

nancydru’s picture

Status: Fixed » Closed (fixed)

Included in new release.