PHP error on counter report

agrigor1 - February 28, 2009 - 11:20
Project:Counter
Version:6.x-1.5
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

This what I get when I visit the report page

Unknown column 'n.language' in 'where clause' query: SELECT COUNT(*) FROM counter WHERE (n.language ='en' OR n.language ='' OR n.language IS NULL) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\...\sites\all\modules\counter\counter.report.inc on line 18.

By the way I didnt update my previous version 6.1.4.
I unistalled it and then installed the new one 6.1.5

The site I have is a multilanguage site with i18n and additional language modules and the error looks like being related to the fact that many languages (6 to be exact) are enabled.

#1

danielb - March 23, 2009 - 02:27

This problem comes from line 16
  $sql_count = db_rewrite_sql('SELECT COUNT(*) FROM {counter}');

This is incorrect use of the function db_rewrite_sql, I believe in this situation, you would not use db_rewrite_sql, or if you wanted to you would do it like this:

  $sql_count = db_rewrite_sql('SELECT COUNT(*) FROM {counter}', '{counter}', 'counter_id');

But I don't think there is any point.
Normally you would use this function when pulling content from tables such as {blocks}, {comments}, {forum}, {node}, {menu}, {term_data} or {vocabulary}
Basically in situations where translations would be appropriate.

#2

drupal-id.com - September 25, 2009 - 15:04
Status:active» closed

@danielb: thanks for your patch, I will applied this on Counter 6.x-2.x version.

To avoid any duplicates then I will fix this bug on this post http://drupal.org/node/335680

 
 

Drupal is a registered trademark of Dries Buytaert.