Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Error with query for sites

Status Resolved
Add-on / Version
Severity Critical
EE Version 24

Pierre Bayartz

Mar 06, 2013

Hi,

I’m getting more and more in trouble with your extension called “snippetsync”. I get the following error with channel ratings from devdemon:

{"error":"

Error Number: 1064<\/p>\n\n

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 '`.`title`, `exp_`ct`.`url_title`, `exp_`ch`.`channel_title`, `exp_`cr`.`rating`,' at line 1<\/p>\n\n

SELECT `exp_`ct`.`title`, `exp_`ct`.`url_title`, `exp_`ch`.`channel_title`, `exp_`cr`.`rating`, `exp_`cr`.`rating_status`, `exp_`cr`.`rating_date`, `exp_`cr`.`rating_author_id`, `exp_`cr`.`rating_id`, `exp_`mb`.`screen_name` AS rating_author_screen_name, `site_name`, `site_id`\nFROM (`exp_channel_ratings` cr, `exp_sites`)\nLEFT JOIN `exp_members` mb ON `mb`.`member_id` = `cr`.`rating_author_id`\nLEFT JOIN `exp_channel_titles` ct ON `ct`.`entry_id` = `cr`.`entry_id`\nLEFT JOIN `exp_channels` ch ON `ch`.`channel_id` = `cr`.`channel_id`\nWHERE `cr`.`site_id` = '1'\nAND `cr`.`collection_id` = '1'\nAND `cr`.`rating_type` = 1\nAND `cr`.`field_id` = 0\nLIMIT 15<\/p>\n\n

Filename: third_party\/snippet_sync\/ext.snippet_sync.php<\/p>\n\n

Line Number: 63<\/p>"} Can you help me please? Thanks and best regards Pierre Bayartz

#1

BoldMinded (Brian)

I have a feeling its not Snippet Sync that is the issue. That error is on this line

$this->EE->db->select('site_name')
                              ->select('site_id')
                              ->get('sites')
                              ->result_array();

Which is a complete query. I’ve seen similar errors happen with other add-ons that were constructing partial queries in active record. It looks like channel ratings is creating a query and not finishing it, then it gets to Snippet Sync and the active record object still has a constructed query string. I bet if you disabled channel ratings or turned off all its hooks in exp_extensions table Snippet Sync won’t throw that error anymore.

#2

Pierre Bayartz

Thanks for your fast response! Unfortunately channel ratings isn’t the only extension which has problems with snippetsync. I don’t know exactly which other extensions were affected… Anyway… This error is shown when I open the channel ratings module in the CP.

#3

BoldMinded (Brian)

On line 60 of ext.snippet_sync.php just before the query you can try adding this:

$this->EE->db->reset();

Other than that I really don’t have any ideas b/c there is nothing fancy happening in this file… the query in the constructor is perfectly valid.

#4

Pierre Bayartz

Another error occurs with the addon Cartthrob:

Column ‘site_id’ in field list is ambiguous

SELECT template_id, template_name, group_name, site_name, site_id FROM (exp_templates, exp_sites) JOIN exp_template_groups ON exp_templates.group_id = exp_template_groups.group_id WHERE status NOT IN (‘closed’, ‘In Bezahlung’, ‘closed’, ‘closed’, ‘closed’, ‘closed’, ‘closed’, ‘closed’, ‘closed’, ‘In Bezahlung_offsite’) AND status NOT IN (‘closed’, ‘In Bezahlung’, ‘closed’, ‘closed’, ‘closed’, ‘closed’, ‘closed’, ‘closed’, ‘closed’, ‘In Bezahlung_offsite’) AND status NOT IN (‘closed’, ‘In Bezahlung’, ‘closed’, ‘closed’, ‘closed’, ‘closed’, ‘closed’, ‘closed’, ‘closed’, ‘In Bezahlung_offsite’) AND status NOT IN (‘closed’, ‘In Bezahlung’, ‘closed’, ‘closed’, ‘closed’, ‘closed’, ‘closed’, ‘closed’, ‘closed’, ‘In Bezahlung_offsite’) AND exp_templates.site_id = ‘1’ ORDER BY group_name, template_name

Filename: third_party/snippet_sync/ext.snippet_sync.php

Line Number: 62

If I use your code snippet above this error occurs:

Fatal error: Call to undefined method CI_DB_mysql_driver::reset() in /srv/expengine/system/expressionengine/third_party/snippet_sync/ext.snippet_sync.php on line 60

#5

BoldMinded (Brian)

Try this instead

$this->EE->db->_reset_select();
#6

BoldMinded (Brian)

Any updates? Dis the reset_select fix it?

#7

Pierre Bayartz

Hi,

sorry for my late reply. This fix worked for me! Thanks for your time.

Best regards

#8

BoldMinded (Brian)

Sweet. Thanks!

Login to reply