CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Newsletter signup form Profile returns DB Error: syntax error on submit
Pages: [1]

Author Topic: Newsletter signup form Profile returns DB Error: syntax error on submit  (Read 1546 times)

seni

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.3.7
  • CMS version: WordPress
  • MySQL version: Ver 14.14 Distrib 5.5.32
  • PHP version: PHP 5.4.9
Newsletter signup form Profile returns DB Error: syntax error on submit
February 16, 2015, 10:09:50 am
Hi

I've created a signup form for newsletter group with the help of http://book.civicrm.org/user/current/email/setup/ documentation. The signup fields has only one field - email. When I use the HTML snippet on my wordpress page I get DB Error: syntax error. I'm not sure whats wrong, it seems that there is a problem with querying the database. Does anybody knows how to fix this? Is this a common problem?

Thanks



I'm using CiviCRM 4.5.5 and WordPress 4.1

Error details:
Code: [Select]
Database Error Code: 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 id1, id2 ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight)' at line 1, 1064

Additional Details:

Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -2
    [message] => DB Error: syntax error
    [mode] => 16
    [debug_info] => INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 GROUP BY id1, id2 ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight) [nativecode=1064 ** 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 id1, id2 ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight)' at line 1]
    [type] => DB_Error
    [user_info] => INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 GROUP BY id1, id2 ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight) [nativecode=1064 ** 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 id1, id2 ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight)' at line 1]
    [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 GROUP BY id1, id2 ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight) [nativecode=1064 ** 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 id1, id2 ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight)' at line 1]"]
)



BackTrace:
Code: [Select]
#0 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(191): CRM_Core_Error::backtrace()
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
#3 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/packages/DB.php(975): PEAR_Error->PEAR_Error("DB Error: syntax error", -2, 16, (Array:2), "INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 G...")
#4 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-2, 16, (Array:2), "INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 G...")
#5 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -2, NULL, NULL, "INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 G...", "DB_Error", TRUE)
#6 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/packages/DB/mysql.php(899): DB_common->raiseError(-2, NULL, NULL, NULL, "1064 ** You have an error in your SQL syntax; check the manual that correspon...")
#7 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/packages/DB/mysql.php(328): DB_mysql->mysqlRaiseError()
#8 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 G...")
#9 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(2442): DB_common->query("INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 G...")
#10 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(1634): DB_DataObject->_query("INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 G...")
#11 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(325): DB_DataObject->query("INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 G...")
#12 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Dedupe/BAO/RuleGroup.php(255): CRM_Core_DAO->query("INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 G...")
#13 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Dedupe/Finder.php(122): CRM_Dedupe_BAO_RuleGroup->fillTable()
#14 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Profile/Form.php(945): CRM_Dedupe_Finder::dupesByParams((Array:2), "Individual", "Unsupervised", (Array:0))
#15 [internal function](): CRM_Profile_Form::formRule((Array:5), (Array:0), Object(CRM_Profile_Form_Edit))
#16 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm.php(1598): call_user_func((Array:2), (Array:5), (Array:0), Object(CRM_Profile_Form_Edit))
#17 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(397): HTML_QuickForm->validate()
#18 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Profile/Form/Edit.php(323): CRM_Core_Form->validate()
#19 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/StateMachine.php(144): CRM_Profile_Form_Edit->validate()
#20 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Next.php(60): CRM_Core_StateMachine->perform(Object(CRM_Profile_Form_Edit), "next", "Next")
#21 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Profile_Form_Edit), "next")
#22 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Profile_Form_Edit), "next")
#23 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(356): HTML_QuickForm_Page->handle("next")
#24 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/Wrapper.php(117): CRM_Core_Controller->run()
#25 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Profile/Page/Router.php(121): CRM_Utils_Wrapper->run("CRM_Profile_Form_Edit", "Create Profile", (Array:2))
#26 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(331): CRM_Profile_Page_Router->run((Array:3), NULL)
#27 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(75): CRM_Core_Invoke::runItem((Array:14))
#28 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
#29 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm.php(506): CRM_Core_Invoke::invoke((Array:3))
#30 [internal function](): CiviCRM_For_WordPress->invoke("<p>my_site is the...")
#31 /srv/www/my_site/htdocs/wp-includes/plugin.php(213): call_user_func_array((Array:2), (Array:1))
#32 /srv/www/my_site/htdocs/wp-includes/post-template.php(221): apply_filters("the_content", "my_site is the...")
#33 /srv/www/my_site/htdocs/wp-content/themes/my_site_2014/front-page.php(115): the_content()
#34 /srv/www/my_site/htdocs/wp-includes/template-loader.php(74): include("/srv/www/my_site/htdocs/wp-content/themes/my_site_2014/front-page.php")
#35 /srv/www/my_site/htdocs/wp-blog-header.php(16): require_once("/srv/www/my_site/htdocs/wp-includes/template-loader.php")
#36 /srv/www/my_site/htdocs/index.php(17): require("/srv/www/my_site/htdocs/wp-blog-header.php")
#37 {main}



Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Newsletter signup form Profile returns DB Error: syntax error on submit
February 18, 2015, 05:15:50 am
Yes, the SQL is malformed but I'm not sure why. Are you using CiviCRM 4.3.7? Can you upgrade to 4.5.6? Then we will be much better able to help you.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

seni

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.3.7
  • CMS version: WordPress
  • MySQL version: Ver 14.14 Distrib 5.5.32
  • PHP version: PHP 5.4.9
Re: Newsletter signup form Profile returns DB Error: syntax error on submit
February 19, 2015, 01:00:56 pm
I was runing CiviCRM 4.5.5. But I've updated it to 4.5.6 and the error is still there.

I'm not sure what's with all the 0 (zeros) in the query statement *...SELECT 0 id1, 0 id2, 0 weight LIMIT 0 GROUP...* could that be the source of problem?

Just in case a number or two were changed, this is the error from 4.5.6 version

Code: [Select]
DB Error: syntax error
Error Details
Database Error Code: 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 id1, id2 ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight)' at line 1, 1064

Additional Details:
Code: [Select]
Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -2
    [message] => DB Error: syntax error
    [mode] => 16
    [debug_info] => INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 GROUP BY id1, id2 ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight) [nativecode=1064 ** 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 id1, id2 ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight)' at line 1]
    [type] => DB_Error
    [user_info] => INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 GROUP BY id1, id2 ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight) [nativecode=1064 ** 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 id1, id2 ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight)' at line 1]
    [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 GROUP BY id1, id2 ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight) [nativecode=1064 ** 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 id1, id2 ON DUPLICATE KEY UPDATE weight = weight + VALUES(weight)' at line 1]"]
)

Backtrace
Code: [Select]
#0 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(191): CRM_Core_Error::backtrace()
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
#3 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/packages/DB.php(975): PEAR_Error->PEAR_Error("DB Error: syntax error", -2, 16, (Array:2), "INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 G...")
#4 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-2, 16, (Array:2), "INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 G...")
#5 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -2, NULL, NULL, "INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 G...", "DB_Error", TRUE)
#6 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/packages/DB/mysql.php(899): DB_common->raiseError(-2, NULL, NULL, NULL, "1064 ** You have an error in your SQL syntax; check the manual that correspon...")
#7 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/packages/DB/mysql.php(328): DB_mysql->mysqlRaiseError()
#8 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 G...")
#9 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(2442): DB_common->query("INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 G...")
#10 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(1634): DB_DataObject->_query("INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 G...")
#11 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(325): DB_DataObject->query("INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 G...")
#12 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Dedupe/BAO/RuleGroup.php(255): CRM_Core_DAO->query("INSERT INTO dedupe (id1, id2, weight) SELECT 0 id1, 0 id2, 0 weight LIMIT 0 G...")
#13 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Dedupe/Finder.php(122): CRM_Dedupe_BAO_RuleGroup->fillTable()
#14 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Profile/Form.php(945): CRM_Dedupe_Finder::dupesByParams((Array:2), "Individual", "Unsupervised", (Array:0))
#15 [internal function](): CRM_Profile_Form::formRule((Array:5), (Array:0), Object(CRM_Profile_Form_Edit))
#16 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm.php(1598): call_user_func((Array:2), (Array:5), (Array:0), Object(CRM_Profile_Form_Edit))
#17 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(397): HTML_QuickForm->validate()
#18 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Profile/Form/Edit.php(323): CRM_Core_Form->validate()
#19 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/StateMachine.php(144): CRM_Profile_Form_Edit->validate()
#20 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Next.php(60): CRM_Core_StateMachine->perform(Object(CRM_Profile_Form_Edit), "next", "Next")
#21 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Profile_Form_Edit), "next")
#22 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Profile_Form_Edit), "next")
#23 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(356): HTML_QuickForm_Page->handle("next")
#24 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/Wrapper.php(117): CRM_Core_Controller->run()
#25 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Profile/Page/Router.php(121): CRM_Utils_Wrapper->run("CRM_Profile_Form_Edit", "Create Profile", (Array:2))
#26 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(335): CRM_Profile_Page_Router->run((Array:3), NULL)
#27 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(79): CRM_Core_Invoke::runItem((Array:14))
#28 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
#29 /srv/www/my_site/htdocs/wp-content/plugins/civicrm/civicrm.php(525): CRM_Core_Invoke::invoke((Array:3))
#30 [internal function](): CiviCRM_For_WordPress->invoke("<p>my_site is the...")
#31 /srv/www/my_site/htdocs/wp-includes/plugin.php(213): call_user_func_array((Array:2), (Array:1))
#32 /srv/www/my_site/htdocs/wp-includes/post-template.php(221): apply_filters("the_content", "my_site is the...")
#33 /srv/www/my_site/htdocs/wp-content/themes/my_site_2014/front-page.php(115): the_content()
#34 /srv/www/my_site/htdocs/wp-includes/template-loader.php(74): include("/srv/www/my_site/htdocs/wp-content/themes/my_site_2014/front-page.php")
#35 /srv/www/my_site/htdocs/wp-blog-header.php(16): require_once("/srv/www/my_site/htdocs/wp-includes/template-loader.php")
#36 /srv/www/my_site/htdocs/index.php(17): require("/srv/www/my_site/htdocs/wp-blog-header.php")
#37 {main}

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • Newsletter signup form Profile returns DB Error: syntax error on submit

This forum was archived on 2017-11-26.