CRM-581 You have an error in your SQL syntax

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Incomplete
    • Affects Version/s: 1.2
    • Fix Version/s: None
    • Labels:
      None

      Description

      I have installed Drupal and CivCRM on my MacOS X 10.2.8 Server running as follows:

      Server OS: Darwin 6.8
      Database: MySQL 4.0.26-standard
      PHP Version: 4.3.10 (Zend: 1.3.0)
      [i.e. Zend Optimizer v2.5.10]

      I used the mySQL query called civicrm_40.mysql to set up the tables, which all goes well.

      When I import the civicrm_generated.mysql query to import data, a numer of lines in the results report say something about Error: Cannot add or update a child... and then when I use the web site and go to CiviCRM, I get this error:

      Sorry. A non-recoverable error has occurred.
      Database Error Code: Cannot add or update a child row: a foreign key constraint fails, 1216

      Before importing that civicrm_generated.mysql, if i went to CiviCRM, I'd get this error instead:

      Find Contacts

      Sorry. A non-recoverable error has occurred.
      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 ') ORDER BY name' at line 1, 1064

      Return to CiviCRM menu.

      error

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

      [code] => -2
      [message] => DB Error: syntax error
      [mode] => 16
      [debug_info] => SELECT id, name FROM civicrm_state_province WHERE country_id IN () ORDER BY name [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 ') ORDER BY name' at line 1]
      [type] => db_error
      [user_info] => SELECT id, name FROM civicrm_state_province WHERE country_id IN () ORDER BY name [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 ') ORDER BY name' at line 1]
      [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT id, name FROM civicrm_state_province WHERE country_id IN () ORDER BY name [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 ') ORDER BY name' at line 1]"]
      )

      Everythin in Drupal is working great. And I did already do a "myisamchk -r" on all the tables.

      I need to use CiviCRM a.s.a.p.! Any help on what to do would be greatly appreciated!!!

        Attachments

          Activity

          [CRM-581] You have an error in your SQL syntax
          David Greenberg added a comment -

          The error you're seeing prior to loading civicrm_generated.mysql is expected behavior. CiviCRM requires successful loading of EITHER civicrm_generated.mysql or civicrm_data.mysql. These scripts load up country, state_province and other tables which are needed.

          We would need to see the errors from the attempt to load civicrm_generated.mysql in order to make progress on this. Please include some name and contact information (email, IM...) in your response.

          dave

          Wyn Douglas added a comment -

          I'm getting the same error when trying to install CiviCRM 1.4 over the following software:

          Mac OS X 10.4.6
          MySQL: 5.0.19
          PHP: 4.4.2
          phpMyAdmin: 2.7.0-pl2

          Drupal's working fine, civicrm_41.mysql imported just fine. But, when I try to import civicrm_generated.mysql I get the following error:

          Error

          SQL query:

          – MySQL dump 10.10

          -- Host: localhost Database: civicrm
          – ------------------------------------------------------
          – Server version 5.0.18-log
          /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;

          MySQL said: Documentation
          #1065 - Query was empty

          When I try to import civicrm_data.mysql I get the following:

          Error

          SQL query:

          /*!40101 SET NAMES utf8 */;

          MySQL said: Documentation
          #1065 - Query was empty

          Any help is greatly appreciate! Love the program, thanks so much for working on it.

            People

            • Assignee:
              Donald A. Lobo
              Reporter:
              Anonymous

              Dates

              • Created:
                Updated:
                Resolved: