Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2010
    Posts
    4
    Plugin Contributions
    0

    Default 1064:You have an error in your SQL syntax;

    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 'order by p.products_sort_order, pd.products_name order by p.products_sort_order,' at line 1

    Website is www.handsonco.com

    This error I have when I am trying to use search in my website. The order by statement repeated 3 times at the end of SQL. In order to find where is the error come from, I added to code /includes/modules/pages/advanced_search_results/header_php.php everywhere where I found “order by” numbers like " order 1 by”, “order 2 by” and so on. The strange think is just one occurrence of "order by" statement has this number. Looks like”

    crl3x84120x%') )) order 3 by p.products_sort_order, pd.products_name order by p.products_sort_order, pd.products_name order by p.products_sort_order, pd.products_name limit 22 in /home/handsoo6/public_html/includes/classes/db/mysql/query_factory.php on line 120

    I can’t figure out where other 2 occurrences in error message above come from

    Thank you

  2. #2
    Join Date
    Nov 2010
    Posts
    4
    Plugin Contributions
    0

    Default Re: 1064:You have an error in your SQL syntax;

    Sorry guys error log looks like :
    [02-May-2014 12:22:14] 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 'order by p.products_sort_order, pd.products_name order by p.products_sort_order,' at line 1 :: SELECT DISTINCT p.products_image, p.products_quantity , m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_price_sorter, p.products_qty_box_status, p.master_categories_id FROM (znc_products p LEFT JOIN znc_manufacturers m USING(manufacturers_id), znc_products_description pd, znc_categories c, znc_products_to_categories p2c ) LEFT JOIN znc_meta_tags_products_description mtpd ON mtpd.products_id= p2c.products_id AND mtpd.language_id = 1 WHERE (p.products_status = 1 AND p.products_id = pd.products_id AND pd.language_id = 1 AND p.products_id = p2c.products_id AND p2c.categories_id = c.categories_id AND ((pd.products_name LIKE '%crl3x84120x%' OR p.products_model LIKE '%crl3x84120x%' OR m.manufacturers_name LIKE '%crl3x84120x%' OR (mtpd.metatags_keywords LIKE '%crl3x84120x%' AND mtpd.metatags_keywords !='') OR (mtpd.metatags_description LIKE '%crl3x84120x%' AND mtpd.metatags_description !='') OR pd.products_description LIKE '%crl3x84120x%') )) order by p.products_sort_order, pd.products_name order by p.products_sort_order, pd.products_name order by p.products_sort_order, pd.products_name limit 22 in /home/handsoo6/public_html/includes/classes/db/mysql/query_factory.php on line 120

  3. #3
    Join Date
    Jul 2012
    Posts
    16,107
    Plugin Contributions
    17

    Default Re: 1064:You have an error in your SQL syntax;

    Try making the modification suggested by lat9 at the following link. It will give you the location that has caused the error. It will not specifically assist in identifying the other 2 locations of the the sql statement that you have stated exist. (Don't know if they truly do or not)

    http://www.zen-cart.com/showthread.p...aller-on-error
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    Nov 2010
    Posts
    4
    Plugin Contributions
    0

    Default Re: 1064:You have an error in your SQL syntax;

    If you look at SQL error is understandable see below in bold, question is how it is happened! : SELECT DISTINCT p.products_image, p.products_quantity , m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_price_sorter, p.products_qty_box_status, p.master_categories_id FROM (znc_products p LEFT JOIN znc_manufacturers m USING(manufacturers_id), znc_products_description pd, znc_categories c, znc_products_to_categories p2c ) LEFT JOIN znc_meta_tags_products_description mtpd ON mtpd.products_id= p2c.products_id AND mtpd.language_id = 1 WHERE (p.products_status = 1 AND p.products_id = pd.products_id AND pd.language_id = 1 AND p.products_id = p2c.products_id AND p2c.categories_id = c.categories_id AND ((pd.products_name LIKE '%crl3x84120x%' OR p.products_model LIKE '%crl3x84120x%' OR m.manufacturers_name LIKE '%crl3x84120x%' OR (mtpd.metatags_keywords LIKE '%crl3x84120x%' AND mtpd.metatags_keywords !='') OR (mtpd.metatags_description LIKE '%crl3x84120x%' AND mtpd.metatags_description !='') OR pd.products_description LIKE '%crl3x84120x%') )) order by p.products_sort_order, pd.products_name order by p.products_sort_order, pd.products_name order by p.products_sort_order, pd.products_name

  5. #5
    Join Date
    Jul 2012
    Posts
    16,107
    Plugin Contributions
    17

    Default Re: 1064:You have an error in your SQL syntax;

    Quote Originally Posted by holsterland View Post
    If you look at SQL error is understandable see below in bold, question is how it is happened! : SELECT DISTINCT p.products_image, p.products_quantity , m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_price_sorter, p.products_qty_box_status, p.master_categories_id FROM (znc_products p LEFT JOIN znc_manufacturers m USING(manufacturers_id), znc_products_description pd, znc_categories c, znc_products_to_categories p2c ) LEFT JOIN znc_meta_tags_products_description mtpd ON mtpd.products_id= p2c.products_id AND mtpd.language_id = 1 WHERE (p.products_status = 1 AND p.products_id = pd.products_id AND pd.language_id = 1 AND p.products_id = p2c.products_id AND p2c.categories_id = c.categories_id AND ((pd.products_name LIKE '%crl3x84120x%' OR p.products_model LIKE '%crl3x84120x%' OR m.manufacturers_name LIKE '%crl3x84120x%' OR (mtpd.metatags_keywords LIKE '%crl3x84120x%' AND mtpd.metatags_keywords !='') OR (mtpd.metatags_description LIKE '%crl3x84120x%' AND mtpd.metatags_description !='') OR pd.products_description LIKE '%crl3x84120x%') )) order by p.products_sort_order, pd.products_name order by p.products_sort_order, pd.products_name order by p.products_sort_order, pd.products_name
    Part of understanding how it has happened is understanding at what line the sql was run that gave/had the incorrect sql statement. Right now all that is known is that an error occured and the query factory (where all sql should be processed) is the last place to know that there was a problem. By adding the code provided by lat9 the line number that pushed the query to the query factory will be returned and from there can back track how the query was created and in your case how two additional order by's that were not in the location that you added numbers appeared in your query.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

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

    Default Re: 1064:You have an error in your SQL syntax;

    Quote Originally Posted by mc12345678 View Post
    Try making the modification suggested by lat9 at the following link. It will give you the location that has caused the error. It will not specifically assist in identifying the other 2 locations of the the sql statement that you have stated exist. (Don't know if they truly do or not)

    http://www.zen-cart.com/showthread.p...aller-on-error
    Regarding the above statement made earlier. Although I am still slightly confused, I will say that something I thought I understood about the original post was that I thought there was a claim of finding a similar query (without all of the order by statements) in multiple locations in the file(s). It seemed that the OP was trying to identify where else the same query was generated/used. I thought that there was a claim that three such locations existed and that two were still to be discovered.

    Anyways, the suggestion of adding the sql debug code offered by lat9 and to be incorporated into 1.6.0 as I understand remains my suggestion at this time regardless of what I previously understood/misunderstood.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. v139h 1064 You have an error in your SQL syntax;
    By alwaysanirudh in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 11 Oct 2012, 04:13 PM
  2. 1064 You have an error in your SQL syntax
    By snagroot in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 14 Nov 2010, 01:43 AM
  3. 1064 You have an error in your SQL syntax;
    By limelites in forum General Questions
    Replies: 6
    Last Post: 10 Jun 2009, 07:35 PM
  4. 1064 You have an error in your SQL syntax
    By phastings in forum General Questions
    Replies: 1
    Last Post: 18 Dec 2008, 06:12 AM
  5. 1064 You have an error in your SQL syntax
    By dealbyethan.com in forum General Questions
    Replies: 3
    Last Post: 14 Apr 2007, 04:34 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