I just upgraded Tagadelic Views to 1.1 and this error popped up when I tried to use a view with tagadelic enabled:

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 near ',,,,,,,,,,,,,) GROUP BY d.tid, d.name, d.vid ORDER BY count DESC LIMIT 0, 15' at line 1 query: SELECT COUNT(*) AS count, d.tid, d.name, d.vid FROM drupal_term_data d INNER JOIN drupal_term_node n ON d.tid = n.tid WHERE n.nid IN (,,,,,,,,,,,,,,) GROUP BY d.tid, d.name, d.vid ORDER BY count DESC LIMIT 0, 15 in C:\Program Files\xampp\htdocs\nacisto\modules\tagadelic_views\theme\theme.inc on line 48.

Line 48 in the theme.inc file reads:

$result = db_query_range('SELECT COUNT(*) AS count, d.tid, d.name, d.vid FROM {term_data} d INNER JOIN {term_node} n ON d.tid = n.tid WHERE n.nid IN '. $nid_restrictor . $vid_restrictor .' GROUP BY d.tid, d.name, d.vid ORDER BY count DESC', 0, $options['size']);

I'm sure this is probably just an oversight on my side, but unfortunatelly I don't understand PHP that much. Any advice welcomed.

Up until now, I used tagadelic views with no trouble.

CommentFileSizeAuthor
#5 patch_theme.patch1.14 KBrgb0019
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

techgirlgeek’s picture

This is coming from not have the View associated with any nodes yet.
Basically it expects to find nodes, and the nid's for the pages should be being listed where the ,,,,,,'s are.

proguru2’s picture

I've ran into a similar issues w/ that specific line. Long time drupal user, just installed tagadelic / tagadelic_views, created a tagadelic block view which I added to my sidebar.

I noticed that only a few tags were being displayed in the block view, and after _alot_ of debugging, I saw that the nid_restrictions was restricting the tags listed to those only associated with the first 10 nodes or so in the database. After making the following change, tagadelic worked as expected, displaying all tags that are associated w/ any node in my db.

Change line 48 of modules/tagadelic_views/theme/theme.inc from

$result = db_query_range('SELECT COUNT(*) AS count, d.tid, d.name, d.vid FROM {term_data} d INNER JOIN {term_node} n ON d.tid = n.tid WHERE n.nid IN '. $nid_restrictor .' GROUP BY d.tid, d.name, d.vid ORDER BY count DESC', 0, $options['size']);

to:

$result = db_query_range('SELECT COUNT(*) AS count, d.tid, d.name, d.vid FROM {term_data} d INNER JOIN {term_node} n ON d.tid = n.tid GROUP BY d.tid, d.name, d.vid ORDER BY count DESC', 0, $options['size']);

markus_cz’s picture

Status: Active » Closed (fixed)

proguru2, thank you very, very much! It works perfectly, you've just saved my day :)

rgb0019’s picture

Hi,
I change the line 48 in theme.inc by:
$result = db_query_range('SELECT COUNT(*) AS count, d.tid, d.name, d.vid FROM {term_data} d INNER JOIN {term_node} n ON d.tid = n.tid GROUP BY d.tid, d.name, d.vid ORDER BY count DESC', 0, $options['size']);
But this show terms of all vocabularies.

My solution is to change line 15 by:
$nids[] = $node->tid;

line 37 by
$vid_restrictor = "(" . implode(',', $vids). ")";

and line 48 by:
$result = db_query_range('SELECT COUNT(*) AS count, d.tid, d.name, d.vid FROM {term_data} d INNER JOIN {term_node} n ON d.tid = n.tid WHERE d.vid IN '.$vid_restrictor . ' GROUP BY d.tid, d.name, d.vid ORDER BY count DESC', 0, $options['size']);

This query has the vocabularies restrictions.

rgb0019’s picture

FileSize
1.14 KB

Here is the patch