1

I'm getting the above error reported and I have no idea where to look to solve it.

The URL generating the error is http://adpca.org/civicrm/contribute/transact?reset=1&id=3

The log / stacktrace follows: May 14 20:37:47 [info] $Fatal Error Details = Array ( [callback] => Array ( [0] => CRM_Core_Error [1] => handle )

[code] => -2
[message] => DB Error: syntax error
[mode] => 16
[debug_info] => 

SELECT contact_a.id as contact_id -- and many more fields FROM civicrm_contact contact_a LEFT JOIN civicrm_address 1-address ON (1-address.contact_id = contact_a.id AND 1-address.is_primary = 1)
LEFT JOIN civicrm_phone 1-phone-1 ON contact_a.id = 1-phone-1.contact_id AND ( 1-phone-1.phone_type_id = '1' OR 1-phone-1.phone_type_id IS NULL ) AND ( 1-phone-1.is_primary = 1 )
LEFT JOIN civicrm_location_type 1-location_type ON ( ( 1-address.location_type_id = 1-location_type.id ) OR ( 1-phone-1.location_type_id = 1-location_type.id ) )
LEFT JOIN civicrm_value_contact_additional_info_1 ON civicrm_value_contact_additional_info_1.entity_id = contact_a.id
LEFT JOIN civicrm_website website--url ON (website--url.contact_id = contact_a.id AND website--url.website_type_id = ) WHERE ( contact_a.id = '2' ) LIMIT 0, 25
[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 ') WHERE ( contact_a.id = '2' ) LIMIT 0, 25' at line 6] [type] => DB_Error [user_info] => SELECT contact_a.id as contact_id -- and many more fields
FROM civicrm_contact contact_a LEFT JOIN civicrm_address 1-address ON (1-address.contact_id = contact_a.id AND 1-address.is_primary = 1)
LEFT JOIN civicrm_phone 1-phone-1 ON contact_a.id = 1-phone-1.contact_id AND ( 1-phone-1.phone_type_id = '1' OR 1-phone-1.phone_type_id IS NULL ) AND ( 1-phone-1.is_primary = 1 )
LEFT JOIN civicrm_location_type 1-location_type ON ( ( 1-address.location_type_id = 1-location_type.id ) OR ( 1-phone-1.location_type_id = 1-location_type.id ) )
LEFT JOIN civicrm_value_contact_additional_info_1 ON civicrm_value_contact_additional_info_1.entity_id = contact_a.id
LEFT JOIN civicrm_website website--url ON (website--url.contact_id = contact_a.id AND website--url.website_type_id = ) WHERE ( contact_a.id = '2' ) LIMIT 0, 25
[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 ') WHERE ( contact_a.id = '2' ) LIMIT 0, 25' at line 6] [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT contact_a.id as contact_id -- and many more fields FROM civicrm_contact contact_a LEFT JOIN civicrm_address 1-address ON (1-address.contact_id = contact_a.id AND 1-address.is_primary = 1)
LEFT JOIN civicrm_phone 1-phone-1 ON contact_a.id = 1-phone-1.contact_id AND ( 1-phone-1.phone_type_id = '1' OR 1-phone-1.phone_type_id IS NULL ) AND ( 1-phone-1.is_primary = 1 )
LEFT JOIN civicrm_location_type 1-location_type ON ( ( 1-address.location_type_id = 1-location_type.id ) OR ( 1-phone-1.location_type_id = 1-location_type.id ) )
LEFT JOIN civicrm_value_contact_additional_info_1 ON civicrm_value_contact_additional_info_1.entity_id = contact_a.id
LEFT JOIN civicrm_website website--url ON (website--url.contact_id = contact_a.id AND website--url.website_type_id = ) WHERE ( contact_a.id = '2' ) LIMIT 0, 25 [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 ') WHERE ( contact_a.id = '2' ) LIMIT 0, 25' at line 6]"] )

May 14 20:37:47 [info] $backTrace = #0 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/CRM/Core/Error.php(235): CRM_Core_Error::backtrace("backTrace", TRUE) #1 internal function: CRM_Core_Error::handle(Object(DB_Error)) #2 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error)) #3 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/packages/DB.php(976): PEAR_Error->PEAR_Error("DB Error: syntax error", -2, 16, (Array:2), "SELECT contact_a.id as contact_id, contact_a.contact_type as contact_type,...") #4 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-2, 16, (Array:2), "SELECT contact_a.id as contact_id, contact_a.contact_type as contact_type,...") #5 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -2, NULL, NULL, "SELECT contact_a.id as contact_id, contact_a.contact_type as contact_type,...", "DB_Error", TRUE) #6 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/packages/DB/mysql.php(895): DB_common->raiseError(-2, NULL, NULL, NULL, "1064 ** You have an error in your SQL syntax; check the manual that correspon...") #7 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/packages/DB/mysql.php(328): DB_mysql->mysqlRaiseError() #8 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("SELECT contact_a.id as contact_id, contact_a.contact_type as contact_type,...") #9 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/packages/DB/DataObject.php(2442): DB_common->query("SELECT contact_a.id as contact_id, contact_a.contact_type as contact_type,...") #10 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/packages/DB/DataObject.php(1634): DB_DataObject->_query("SELECT contact_a.id as contact_id, contact_a.contact_type as contact_type,...") #11 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/CRM/Core/DAO.php(325): DB_DataObject->query("SELECT contact_a.id as contact_id, contact_a.contact_type as contact_type,...") #12 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/CRM/Core/DAO.php(1192): CRM_Core_DAO->query("SELECT contact_a.id as contact_id, contact_a.contact_type as contact_type,...", TRUE) #13 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/CRM/Contact/BAO/Query.php(4353): CRM_Core_DAO::executeQuery("SELECT contact_a.id as contact_id, contact_a.contact_type as contact_type,...") #14 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/CRM/Contact/BAO/Contact.php(1644): CRM_Contact_BAO_Query::apiQuery((Array:1), (Array:19), (Array:0)) #15 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/CRM/Core/BAO/UFGroup.php(2343): CRM_Contact_BAO_Contact::getHierContactDetails("2", (Array:23)) #16 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/CRM/Contribute/Form/Contribution/Main.php(226): CRM_Core_BAO_UFGroup::setProfileDefaults("2", (Array:23), (Array:0)) #17 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/CRM/Core/Form.php(478): CRM_Contribute_Form_Contribution_Main->setDefaultValues() #18 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Display.php(94): CRM_Core_Form->buildForm() #19 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Display->perform(Object(CRM_Contribute_Form_Contribution_Main), "display") #20 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contribute_Form_Contribution_Main), "display") #21 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/CRM/Core/Controller.php(353): HTML_QuickForm_Page->handle("display") #22 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/CRM/Core/Invoke.php(312): CRM_Core_Controller->run((Array:3), NULL) #23 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:15)) #24 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:3)) #25 /usr/home/adpca/public_html/adpca.org.737/sites/all/modules/civicrm/drupal/civicrm.module(489): CRM_Core_Invoke::invoke((Array:3)) #26 internal function: civicrm_invoke("contribute", "transact") #27 /usr/home/adpca/public_html/adpca.org.737/includes/menu.inc(527): call_user_func_array("civicrm_invoke", (Array:2)) #28 /usr/home/adpca/public_html/adpca.org.737/index.php(21): menu_execute_active_handler() #29 {main} Any help to solve this would be appreciated.

  • Is there any more detailed information in the CiviCRM log file in files/civicrm/ConfigAndLog/ ? – davejenx May 9 '16 at 12:33
  • This error doesn't appear when I click the link now. I'm guessing you fixed it. If so, please post the answer to a) help the community and b) earn some easy Stack Exchange reputation points! – Jon G - Megaphone Tech May 10 '16 at 4:36
  • Jon's comment that the error seems fixed surprised me as I've done nothing - so i clicked the link myself & still get the error. But, of course, I'm logged in. I logged out and don't get the error. So, it only happens for registered users. – Dave R. May 14 '16 at 19:39
  • I have managed to get additional information but it's too big to post here. I have put the entry from the log file in http://adpca.org/debuglog.txt. – Dave R. May 14 '16 at 19:41
  • It looks like the faulting SQL is the join LEFT JOIN civicrm_website website--url ON (website--url.contact_id = contact_a.id AND website--url.website_type_id = ) - obviously this is missing a value. @JonG, @davejenx. – Dave R. May 14 '16 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.