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 Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Add new Option Value throws SQL error in 3.2.3
Pages: [1]

Author Topic: Add new Option Value throws SQL error in 3.2.3  (Read 771 times)

charleslcso

  • I post occasionally
  • **
  • Posts: 31
  • Karma: 0
  • CiviCRM version: 3.2.5
  • CMS version: Drupal 6.19
  • MySQL version: 5.1.50
  • PHP version: 5.3.2
Add new Option Value throws SQL error in 3.2.3
December 29, 2010, 09:40:30 am
Folks, I need to add new Option Values. After clicking on "New Option Value" link I get the following in CiviCRM 3.2.3. What's the workaround?


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 '' at line 1, 1064
Additional Details:
Array
(
    [callback] => Array
        (
           
  • => CRM_Core_Error
  • [1] => handle
            )

       
Code: [Select]
=> -2
    [message] => DB Error: syntax error
    [mode] => 16
    [debug_info] => SELECT max( `weight` ) as weight FROM `civicrm_option_value` where option_group_id= [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 '' at line 1]
    [type] => DB_Error
    [user_info] => SELECT max( `weight` ) as weight FROM `civicrm_option_value` where option_group_id= [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 '' at line 1]
    [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT max( `weight` ) as weight FROM `civicrm_option_value` where option_group_id= [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 '' at line 1]"]
)

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Add new Option Value throws SQL error in 3.2.3
December 29, 2010, 10:20:29 am
The query error indicates that you're trying to add an option_value row w/o specifying the option_group it belongs to. Please describe the steps you are taking (menu item / url's) to get this error. Option value records are used in many different places.
Protect your investment in CiviCRM by  becoming a Member!

charleslcso

  • I post occasionally
  • **
  • Posts: 31
  • Karma: 0
  • CiviCRM version: 3.2.5
  • CMS version: Drupal 6.19
  • MySQL version: 5.1.50
  • PHP version: 5.3.2
Re: Add new Option Value throws SQL error in 3.2.3
December 29, 2010, 10:34:03 am
Quote from: Dave Greenberg on December 29, 2010, 10:20:29 am
The query error indicates that you're trying to add an option_value row w/o specifying the option_group it belongs to. Please describe the steps you are taking (menu item / url's) to get this error. Option value records are used in many different places.

I somehow got into the "New Option" page, from somewhere. I couldn't find it from under the Administrator menu.

Luckily I copied the URL and I just paste it into the web browser and in I go. Here is the link :

http://server.com/index.php?q=civicrm/admin/optionValue&reset=1&action=browse

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Add new Option Value throws SQL error in 3.2.3
December 30, 2010, 10:56:06 am
That isn't a valid URL - what exactly are you trying to do? What functionality are you trying to add an option value for? There should be valid menu-based links for most purposes (under Administer > Option Lists, or under Administer > Customize > Custom Data (drill down to Custom Fields / Multiple Choice Options).
Protect your investment in CiviCRM by  becoming a Member!

charleslcso

  • I post occasionally
  • **
  • Posts: 31
  • Karma: 0
  • CiviCRM version: 3.2.5
  • CMS version: Drupal 6.19
  • MySQL version: 5.1.50
  • PHP version: 5.3.2
Re: Add new Option Value throws SQL error in 3.2.3
December 31, 2010, 07:42:59 am
Quote from: Dave Greenberg on December 30, 2010, 10:56:06 am
That isn't a valid URL - what exactly are you trying to do? What functionality are you trying to add an option value for? There should be valid menu-based links for most purposes (under Administer > Option Lists, or under Administer > Customize > Custom Data (drill down to Custom Fields / Multiple Choice Options).

Thanks Dave for the pointer! I got it working now.


Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Add new Option Value throws SQL error in 3.2.3

This forum was archived on 2017-11-26.