I have the following view for comments page on my site:
$view = new stdClass();
$view->name = 'comments';
$view->description = 'All comments';
$view->access = array (
);
$view->view_args_php = '';
$view->page = TRUE;
$view->page_title = '';
$view->page_header = '';
$view->page_header_format = '1';
$view->page_footer = '<hr />';
$view->page_footer_format = '3';
$view->page_empty = '';
$view->page_empty_format = '1';
$view->page_type = 'table';
$view->url = 'comments/recent';
$view->use_pager = TRUE;
$view->nodes_per_page = '20';
$view->menu = TRUE;
$view->menu_title = 'All comments';
$view->menu_tab = TRUE;
$view->menu_tab_weight = '10';
$view->menu_tab_default = TRUE;
$view->menu_tab_default_parent = NULL;
$view->menu_tab_default_parent_type = 'normal';
$view->menu_parent_tab_weight = '0';
$view->menu_parent_title = '';
$view->sort = array (
array (
'tablename' => 'comments',
'field' => 'timestamp',
'sortorder' => 'DESC',
'options' => 'normal',
),
);
$view->argument = array (
);
$view->field = array (
array (
'tablename' => 'comments',
'field' => 'comment',
'label' => '',
),
array (
'tablename' => 'node',
'field' => 'view',
'label' => '',
),
array (
'tablename' => 'node_counter',
'field' => 'totalcount',
'label' => '',
),
array (
'tablename' => 'comments',
'field' => 'add',
'label' => '',
),
array (
'tablename' => 'node_comment_statistics',
'field' => 'comment_count',
'label' => '',
'handler' => 'views_handler_comments_with_new',
),
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
array (
'tablename' => 'node_comment_statistics',
'field' => 'comment_count',
'operator' => '>',
'options' => '',
'value' => '0',
),
);
$view->exposed_filter = array (
);
$view->requires = array(comments, node, node_counter, node_comment_statistics);
$views[$view->name] = $view;
When visiting www.mysite.com/comments it shows correctly what I wanted, but logs show several errors:
Error #1:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 query: node_load SELECT n.nid, n.vid, n.type, n.status, n.created, n.changed, n.comment, n.promote, n.sticky, r.timestamp AS revision_timestamp, r.title, r.body, r.teaser, r.log, r.format, u.uid, u.name, u.picture, u.data FROM node n INNER JOIN users u ON u.uid = n.uid INNER JOIN node_revisions r ON r.vid = n.vid WHERE in /home/mysite/public_html/includes/database.mysql.inc on line 172.
Error #2:
implode() [<a href='function.implode'>function.implode</a>]: Bad arguments. in /home/mysite/public_html/modules/node/node.module on line 525.
Error #3:
Invalid argument supplied for foreach() in /home/mysite/public_html/modules/node/node.module on line 521.
What is wrong in my views? What could I change in the views code to avoid these error messages?
Thanks!
Comments
Comment #1
jgumpert commentedI am seeing the same error for a page view on the final page of results. Strange thing is I have 2 identical views for other CCK types and they don't give these errors in the same multi-page situation. So far I can not spot any differences between the views that would cause this.
Comment #2
sunMarking as duplicate of #186778: View with Comment fields throws errors