Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21
  1. #11
    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
    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 ...
    Hi Ajeh,

    Thanks for your help. The database is setup with the prefixes. Searched for UNION and found these. What do we do next?

    /includes/modules/YOUR_TEMPLATE/cart_upsell.php

    Line #34 : $xsell_query_raw .= "(select p.products_id, p.products_image from " . TABLE_PRODUCTS_XSELL . " xp, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where xp.products_id = '" . $prod[$i] . "' and xp.xsell_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . $_SESSION['languages_id'] . "' and p.products_status = '1' order by xp.products_id asc limit " . $extra . ") UNION ";

    Line #91 : and p.products_status = '1' group by p.products_id order by o.date_purchased desc limit " . $extra . ") UNION ";
    Using zencart v.1.3.9e
    Website: http://www.dealbyethan.com
    Email: admin AT dealbyethan DOT com

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

    Default Re: Unknown error in SQL syntax

    Any idea what specific Cross Sell add on you have installed on your site?

    I have a number of them, but none use the cart_upsell.php file ...
    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!

  3. #13
    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
    Any idea what specific Cross Sell add on you have installed on your site?

    I have a number of them, but none use the cart_upsell.php file ...
    Its this one....
    http://www.zen-cart.com/index.php?ma...roducts_id=283

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

    Default Re: Unknown error in SQL syntax

    I found an ancient one just now ...

    Can you see what setting you are using for:
    NUMBER_XSELLS_DISPLAY

    If you do not know where the setting is, go to the Tools ... Developers Tool Kit ...

    In the top input box enter:
    NUMBER_XSELLS_DISPLAY

    Select NONE and click Search ... if it is in the configuration table it will give you the location and you can hit edit ...

    If not, use the bottom input box in the Developers Tool Kit and search on:
    NUMBER_XSELLS_DISPLAY

    see if you can find where the value is defined for this ...
    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. #15
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Unknown error in SQL syntax

    Quote Originally Posted by gilby View Post
    Yeps that is the one I just dug up ...
    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!

  6. #16
    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
    I found an ancient one just now ...

    Can you see what setting you are using for:
    NUMBER_XSELLS_DISPLAY

    If you do not know where the setting is, go to the Tools ... Developers Tool Kit ...

    In the top input box enter:
    NUMBER_XSELLS_DISPLAY

    Select NONE and click Search ... if it is in the configuration table it will give you the location and you can hit edit ...

    If not, use the bottom input box in the Developers Tool Kit and search on:
    NUMBER_XSELLS_DISPLAY

    see if you can find where the value is defined for this ...
    Hi Ajeh,

    The results are

    /includes/modules/YOUR_TEMPLATE/cart_upsell.php

    Line #9 : define('NUMBER_XSELLS_DISPLAY', '6');
    Line #28 : $c = NUMBER_XSELLS_DISPLAY;
    Using zencart v.1.3.9e
    Website: http://www.dealbyethan.com
    Email: admin AT dealbyethan DOT com

  7. #17
    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
    Hi Ajeh,

    The results are

    /includes/modules/YOUR_TEMPLATE/cart_upsell.php

    Line #9 : define('NUMBER_XSELLS_DISPLAY', '6');
    Line #28 : $c = NUMBER_XSELLS_DISPLAY;
    Have you tried my suggestion in post# 10 ??

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

    red flag Re: Unknown error in SQL syntax

    Quote Originally Posted by gilby View Post
    Have you tried my suggestion in post# 10 ??
    Hi, we can try that. But how do we know whether it solves the problem? The error seems to be generated randomly. Not sure how to reproduce it. Any idea?
    Using zencart v.1.3.9e
    Website: http://www.dealbyethan.com
    Email: admin AT dealbyethan DOT com

  9. #19
    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
    Hi, we can try that. But how do we know whether it solves the problem? The error seems to be generated randomly. Not sure how to reproduce it. Any idea?
    Well you could put those 8 items into your shopping cart again and see if it happens

    The problem with the sql statement is right at the very end
    Where it says "limit -1"
    You cannot select with a limit of -1
    (not was it intended to work that way)

    Now that piece of code is generated in the next line after those that I suggest you change using $c
    So at that point $c must be -3
    So with the existing code $c +=2 makes $c equal to -1
    You make sure that the code can never be negative by hard coding it to $c = 2

    Its a problem with how the $c is calculated with various quantities in the cart.
    Rather than spend time working out the correct mathematical fix
    Just hard code it so that it can never be a negative number.

    And of course get back to us if it doesn't work.....

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

    red flag Re: Unknown error in SQL syntax

    Hi,

    Tried adding those 8 xsell products. The error did not reappear. Also found another record where similar error was generated and tried adding those products (NOT xsell products) but the error still did not appear.

    I think the error perhaps depends on what xsell products are displayed? The tricky thing is xsell products are displayed randomly. If anyone is trying to fix the same problem, please report back whether the problem is fixed after trying gilby's suggestion in post #10. Thanks.
    Using zencart v.1.3.9e
    Website: http://www.dealbyethan.com
    Email: admin AT dealbyethan DOT com

 

 
Page 2 of 3 FirstFirst 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