Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2010
    Posts
    79
    Plugin Contributions
    0

    Default i got error message "PHP Fatal error: 1064:You have an error in your SQL syntax;"

    once i click options name manager, options values manager, attributes controller in admin i got an error message "WARNING: An Error occurred, please refresh the page and try again." with blank page.

    so i check logs folder. below the message.

    [05-Dec-2018 06:02:03 UTC] PHP Fatal error: 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 'int)PRODUCTS_OPTIONS_VALUES_TEXT_ID, 1, 'TEXT')' at line 1 :: INSERT INTO products_options_values (products_options_values_id, language_id, products_options_values_name) VALUES ((int)PRODUCTS_OPTIONS_VALUES_TEXT_ID, 1, 'TEXT') in /public_html/includes/classes/db/mysql/query_factory.php on line 120

    can someone help?

    thanks.

  2. #2
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,154
    Plugin Contributions
    11

    Default Re: i got error message "PHP Fatal error: 1064:You have an error in your SQL syntax;

    Might be some help in the similar threads listed below this post.

  3. #3
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,496
    Plugin Contributions
    88

    Default Re: i got error message "PHP Fatal error: 1064:You have an error in your SQL syntax;

    @sungmo, what is the history of your store? The value that is causing that error to be generated (PRODUCTS_OPTIONS_VALUES_TEXT_ID) should be a database-based constant.

    You can correct the error you posted by copying the following, pasting it into your admin's Tools->Install SQL Patches and pressing 'send':
    Code:
    INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('ID for text and file products options values', 'PRODUCTS_OPTIONS_VALUES_TEXT_ID', '0', 'Numeric value of the products_options_values_id used by the text and file attributes.', 6, NULL, now(), now(), NULL, NULL);
    Please note that the zc_install process created that constant, so I'm trying to understand how it was removed from the database in the first place.

  4. #4
    Join Date
    Jul 2012
    Posts
    16,734
    Plugin Contributions
    17

    Default Re: i got error message "PHP Fatal error: 1064:You have an error in your SQL syntax;

    One way to identify the how it happened, is to identify what plugins have been installed or attempted to be installed. There used to be a few that would/could clear records of the database that had a gID equal to 0 which included PRODUCTS_OPTIONS_VALUES_TEXT_ID as well as two other constants that previously were assigned to gID=0 instead of how they have been reassigned to gID=6.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,496
    Plugin Contributions
    88

    Default Re: i got error message "PHP Fatal error: 1064:You have an error in your SQL syntax;

    @mc12345678, actually the constant PRODUCTS_OPTIONS_VALUES_TEXT_ID has been registered in configuration group 6 (hidden/modules) since at least Zen Cart 1.3.8a timeframe.

    That's why I asked the question, since that value isn't one of the three that were previously defined in configuration group 0.

  6. #6
    Join Date
    Jul 2012
    Posts
    16,734
    Plugin Contributions
    17

    Default Re: i got error message "PHP Fatal error: 1064:You have an error in your SQL syntax;

    Quote Originally Posted by lat9 View Post
    @mc12345678, actually the constant PRODUCTS_OPTIONS_VALUES_TEXT_ID has been registered in configuration group 6 (hidden/modules) since at least Zen Cart 1.3.8a timeframe.

    That's why I asked the question, since that value isn't one of the three that were previously defined in configuration group 0.
    My bad, I was thinking mostly of PRODUCTS_OPTIONS_TYPE_SELECT although there were two other configuration_key values that also were stored at gID of 0. Those other two though were not in mind. The request of what plugins had been installed or attempted to be installed/removed still remains as an action. Even though I wrongly attributed PRODUCTS_OPTIONS_VALUE_TEXT_ID to what used to be more of a problem.

    If the issue is associated to some plugin software, then knowing which one would help prevent the same thing from occurring to others.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: i got error message "PHP Fatal error: 1064:You have an error in your SQL syntax;

    Quote Originally Posted by lat9 View Post
    @sungmo, what is the history of your store? The value that is causing that error to be generated (PRODUCTS_OPTIONS_VALUES_TEXT_ID) should be a database-based constant.

    You can correct the error you posted by copying the following, pasting it into your admin's Tools->Install SQL Patches and pressing 'send':
    Code:
    INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('ID for text and file products options values', 'PRODUCTS_OPTIONS_VALUES_TEXT_ID', '0', 'Numeric value of the products_options_values_id used by the text and file attributes.', 6, NULL, now(), now(), NULL, NULL);
    Please note that the zc_install process created that constant, so I'm trying to understand how it was removed from the database in the first place.
    Quote Originally Posted by mc12345678 View Post
    One way to identify the how it happened, is to identify what plugins have been installed or attempted to be installed. There used to be a few that would/could clear records of the database that had a gID equal to 0 which included PRODUCTS_OPTIONS_VALUES_TEXT_ID as well as two other constants that previously were assigned to gID=0 instead of how they have been reassigned to gID=6.
    Quote Originally Posted by lat9 View Post
    @mc12345678, actually the constant PRODUCTS_OPTIONS_VALUES_TEXT_ID has been registered in configuration group 6 (hidden/modules) since at least Zen Cart 1.3.8a timeframe.

    That's why I asked the question, since that value isn't one of the three that were previously defined in configuration group 0.
    Quote Originally Posted by mc12345678 View Post
    My bad, I was thinking mostly of PRODUCTS_OPTIONS_TYPE_SELECT although there were two other configuration_key values that also were stored at gID of 0. Those other two though were not in mind. The request of what plugins had been installed or attempted to be installed/removed still remains as an action. Even though I wrongly attributed PRODUCTS_OPTIONS_VALUE_TEXT_ID to what used to be more of a problem.

    If the issue is associated to some plugin software, then knowing which one would help prevent the same thing from occurring to others.
    No, y'all missed an important distinction here.
    See how the SQL quoted in the error here: "... VALUES ((int)PRODUCTS_OPTIONS_VALUES_TEXT_ID, 1, 'TEXT')... contains the PHP (int) directive?
    While if the "(int)" weren't part of the error message you'd be right, since the error message includes the PHP code for (int), it means someone has tampered with the code and is outputting the PHP into the SQL.
    Solution: put back the original code instead of whatever has been done to change it.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  8. #8
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,496
    Plugin Contributions
    88

    Default Re: i got error message "PHP Fatal error: 1064:You have an error in your SQL syntax;

    Spot on, as usual, DrByte!

 

 

Similar Threads

  1. Replies: 13
    Last Post: 12 Jul 2019, 07:36 PM
  2. v151 PHP Fatal error: 1064:You have an error in your SQL syntax
    By chaptech in forum General Questions
    Replies: 2
    Last Post: 5 Mar 2015, 07:16 PM
  3. PHP Fatal error: 1064:You have an error in your SQL syntax
    By uswebworx in forum General Questions
    Replies: 11
    Last Post: 19 Apr 2012, 09:17 AM
  4. Inatall error "1064 You have an error in your SQL syntax"
    By StatoLNL in forum Installing on a Linux/Unix Server
    Replies: 0
    Last Post: 14 Aug 2011, 08:48 AM
  5. 1064 You have an error in your SQL syntax: "limit -3"
    By dealbyethan.com in forum General Questions
    Replies: 3
    Last Post: 13 Dec 2010, 12:49 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR