Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2006
    Posts
    12
    Plugin Contributions
    0

    Default Mysql syntax error

    I getting the error when after confirming the order

    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 '000000 where products_id = '81'' at line 1
    in:
    [update products set products_ordered = products_ordered + 1,000000 where products_id = '81']


    what can i do?

  2. #2
    Join Date
    Jun 2003
    Posts
    33,715
    Plugin Contributions
    0

    Default Re: Mysql syntax error

    Have you made a change to the code?

  3. #3
    Join Date
    Sep 2006
    Posts
    12
    Plugin Contributions
    0

    Default Re: Mysql syntax error

    no i just changed the characyer set to romanian. if a changed back then worked but then comes another problem. The month names switches back to english.... Example: Octombrie for October

  4. #4
    Join Date
    Sep 2004
    Posts
    1,388
    Plugin Contributions
    4

    Default Re: Mysql syntax error

    It's the comma in your number. You need to get rid of it in this section of your SQL statement:
    Code:
    products_ordered + 1,000000
    Check out the number formatting in your language files and see what it's doing in the code where this SQL executes.
    Frank Koehl
    "Cleverly Disguised as a Responsible Adult"

    frankkoehl.com

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

    Default Re: Mysql syntax error

    in the orders class, around line 711, you have this:
    Code:
          $db->Execute("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%f', $this->products[$i]['qty']) . " where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'");
    It would seem that the %f specifier is adding the comma in the 6th position, based on your locale settings.

    What are your locale settings?
    .

    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.

  6. #6
    Join Date
    Sep 2006
    Posts
    12
    Plugin Contributions
    0

    Default Re: Mysql syntax error

    i replaced the code at the bestseller in the order.php and works fine. i replaced the , to .



    $db->Execute("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . str_replace(',','.',sprintf('%f', $this->products[$i]['qty']) ). " where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'");

    Thanks for replies

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

    Default Re: Mysql syntax error

    .

    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.

 

 

Similar Threads

  1. v138a 1064 Error in SQL Syntax - old v.1.3.8 on new MySQL
    By Chasel in forum Installing on a Windows Server
    Replies: 3
    Last Post: 18 Aug 2012, 07:36 PM
  2. MySQL Syntax error stopped my sending
    By josee225 in forum General Questions
    Replies: 1
    Last Post: 24 May 2009, 04:22 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. MySQL syntax error
    By Waggle Dancer in forum General Questions
    Replies: 13
    Last Post: 13 Feb 2007, 05:06 AM

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