Page 1 of 3 123 LastLast
Results 1 to 10 of 21
  1. #1
    Join Date
    Dec 2005
    Location
    Australia
    Posts
    772
    Plugin Contributions
    0

    red flag Unknown error in SQL syntax

    The following message appears just below the shopping cart (on the "View Cart" page). How do I fix this problem? Please help. Thanks.

    ----------
    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 '-1)' at line 1
    in:
    [(select p.products_id, p.products_image from zen_products_xsell xp, zen_products p, zen_products_description pd where xp.products_id = '9962' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and p.products_status = '1' order by xp.products_id asc limit 2) UNION (select p.products_id, p.products_image from zen_products_xsell xp, zen_products p, zen_products_description pd where xp.products_id = '12603' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and p.products_status = '1' order by xp.products_id asc limit 2) UNION (select p.products_id, p.products_image from zen_products_xsell xp, zen_products p, zen_products_description pd where xp.products_id = '6081' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and p.products_status = '1' order by xp.products_id asc limit 2) UNION (select p.products_id, p.products_image from zen_products_xsell xp, zen_products p, zen_products_description pd where xp.products_id = '5082' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and p.products_status = '1' order by xp.products_id asc limit 2) UNION (select p.products_id, p.products_image from zen_products_xsell xp, zen_products p, zen_products_description pd where xp.products_id = '3304' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and p.products_status = '1' order by xp.products_id asc limit 2) UNION (select p.products_id, p.products_image from zen_products_xsell xp, zen_products p, zen_products_description pd where xp.products_id = '12600' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and p.products_status = '1' order by xp.products_id asc limit 2) UNION (select p.products_id, p.products_image from zen_products_xsell xp, zen_products p, zen_products_description pd where xp.products_id = '10290' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and p.products_status = '1' order by xp.products_id asc limit 2) UNION (select p.products_id, p.products_image from zen_products_xsell xp, zen_products p, zen_products_description pd where xp.products_id = '5668' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and p.products_status = '1' order by xp.products_id asc limit -1)]
    Using zencart v.1.3.9e
    Website: http://www.dealbyethan.com
    Email: admin AT dealbyethan DOT com

  2. #2
    Join Date
    Jan 2004
    Posts
    573
    Plugin Contributions
    0

    Default Re: Unknown error in SQL syntax

    Quote Originally Posted by dealbyethan.com View Post
    The following message appears just below the shopping cart (on the "View Cart" page). How do I fix this problem? Please help. Thanks.

    ----------
    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 '-1)' at line 1
    in:
    [(select p.products_id, p.products_image from zen_products_xsell xp, zen_products p, zen_products_description pd where xp.products_id = '9962' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and p.products_status = '1' order by xp.products_id asc limit 2) UNION (select p.products_id, p.products_image from zen_products_xsell xp, zen_products p, zen_products_description pd where xp.products_id = '12603' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and p.products_status = '1' order by xp.products_id asc limit 2) UNION (select p.products_id, p.products_image from zen_products_xsell xp, zen_products p, zen_products_description pd where xp.products_id = '6081' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and p.products_status = '1' order by xp.products_id asc limit 2) UNION (select p.products_id, p.products_image from zen_products_xsell xp, zen_products p, zen_products_description pd where xp.products_id = '5082' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and p.products_status = '1' order by xp.products_id asc limit 2) UNION (select p.products_id, p.products_image from zen_products_xsell xp, zen_products p, zen_products_description pd where xp.products_id = '3304' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and p.products_status = '1' order by xp.products_id asc limit 2) UNION (select p.products_id, p.products_image from zen_products_xsell xp, zen_products p, zen_products_description pd where xp.products_id = '12600' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and p.products_status = '1' order by xp.products_id asc limit 2) UNION (select p.products_id, p.products_image from zen_products_xsell xp, zen_products p, zen_products_description pd where xp.products_id = '10290' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and p.products_status = '1' order by xp.products_id asc limit 2) UNION (select p.products_id, p.products_image from zen_products_xsell xp, zen_products p, zen_products_description pd where xp.products_id = '5668' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '1' and p.products_status = '1' order by xp.products_id asc limit -1)]
    hi did you ever solve this - i just updated to 1.3.9d and am getting the same issue

  3. #3
    Join Date
    Dec 2005
    Location
    Australia
    Posts
    772
    Plugin Contributions
    0

    red flag Re: Unknown error in SQL syntax

    Not solved yet, still waiting for help.
    Using zencart v.1.3.9e
    Website: http://www.dealbyethan.com
    Email: admin AT dealbyethan DOT com

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Unknown error in SQL syntax

    Are you still using Cross Sell on your site or did you change to Multi Cross Sell or anything?

    Did you check all changes to manage the code for Cross Sell with your upgraded site?

    NOTE: Half of the error message is with prefixes on the table names and half the code is without prefixes on the table names ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Aug 2005
    Location
    Vic, Oz
    Posts
    1,905
    Plugin Contributions
    5

    Default Re: Unknown error in SQL syntax

    Quote Originally Posted by dealbyethan.com View Post
    Not solved yet, still waiting for help.
    Looks like some adaptation of a cross sell on the shopping cart page. Is that right?
    All the items seem to have a limit of 2 items except the last which has a limit of -1
    Minus 1 is not a valid limit

    Haven't looked at the code but I suspect in both cases there might be a total limit of 13 to display and when you add up 7 cross sells with a limit of 2 (total 14) then the next products cross sell has to be a -1 to bring it back to 13

    Its only a theory but you could try setting the cross sell limit to an even number???
    Last edited by gilby; 13 Jul 2010 at 02:55 PM.

  6. #6
    Join Date
    Dec 2005
    Location
    Australia
    Posts
    772
    Plugin Contributions
    0

    red flag Re: Unknown error in SQL syntax

    Quote Originally Posted by Ajeh View Post
    Are you still using Cross Sell on your site or did you change to Multi Cross Sell or anything?

    Did you check all changes to manage the code for Cross Sell with your upgraded site?

    NOTE: Half of the error message is with prefixes on the table names and half the code is without prefixes on the table names ...
    We are using cross sell advanced and did check all changes to manage the code. You said half of the error message is with prefixes on the table names and half the code is without prefixes on the table names. How do I fix this issue?
    Using zencart v.1.3.9e
    Website: http://www.dealbyethan.com
    Email: admin AT dealbyethan DOT com

  7. #7
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Unknown error in SQL syntax

    Is your database setup with tables that use the prefixes or is it setup without the prefixes?

    Your code appears to have mixed settings and you need to first determine which is correct ...

    Then, you will need to find the code that is not using the tables correctly ...

    A search in the Developers Tool Kit for the word:
    UNION

    Zen Cart, by default, does not use UNION on its tables in v1.3.9 ... so a search on that word should help narrow down where that code is used and then you can fix it with the proper calls to the database tables ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  8. #8
    Join Date
    Aug 2005
    Location
    Vic, Oz
    Posts
    1,905
    Plugin Contributions
    5

    Default Re: Unknown error in SQL syntax

    Quote Originally Posted by Ajeh View Post
    Is your database setup with tables that use the prefixes or is it setup without the prefixes?

    Your code appears to have mixed settings and you need to first determine which is correct ...

    Then, you will need to find the code that is not using the tables correctly ...

    A search in the Developers Tool Kit for the word:
    UNION

    Zen Cart, by default, does not use UNION on its tables in v1.3.9 ... so a search on that word should help narrow down where that code is used and then you can fix it with the proper calls to the database tables ...
    I must be missing something!
    All the tables here use 'zen_' as a prefix
    I can't see any that don't use it????

  9. #9
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Unknown error in SQL syntax

    I must be losing my mind ...

    The first time I looked at the SQL I thought I saw references without the zen_ in them ...

    But now I am looking again and they appear to all be there ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  10. #10
    Join Date
    Aug 2005
    Location
    Vic, Oz
    Posts
    1,905
    Plugin Contributions
    5

    Default Re: Unknown error in SQL syntax

    Quote Originally Posted by dealbyethan.com View Post
    Not solved yet, still waiting for help.
    Open includes/modules/YOUR_TEMPLATE/cart_upsell.php

    lines around 38 and 95 read:
    PHP Code:
    $c += 2
    Try changing both to:
    PHP Code:
    $c 2
    See if that works as a quick fix?

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. Replies: 1
    Last Post: 25 Aug 2011, 05:58 AM
  2. Error message 1064 you have an error in your sql syntax
    By honrheart in forum General Questions
    Replies: 1
    Last Post: 11 Sep 2009, 02:38 AM
  3. MySQL Error 1064 You have an error in your SQL syntax;
    By dmm2020 in forum General Questions
    Replies: 2
    Last Post: 22 Feb 2009, 05:02 AM
  4. error message 1064 you have an error in your sql syntax
    By ngsl in forum General Questions
    Replies: 0
    Last Post: 22 Aug 2008, 06:44 AM
  5. SQL Syntax error: check for right syntax to use near '000000
    By gabyone in forum General Questions
    Replies: 2
    Last Post: 9 Feb 2008, 08:23 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