Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2006
    Posts
    4
    Plugin Contributions
    0

    Default SQL syntax bug in order.php with fix/patch for older MySQL

    I have an older MySQL installation (v. 3.23.58) on my host (I don't know if newer version don't have this problem), and the checkout was breaking on step 1 with this error message:
    Code:
    1064 You have an error in your SQL syntax near '(zen_address_book ab left join zen_zones z o' at line 7
    in:
    [select c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address, ab.entry_company, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from zen_customers c, (zen_address_book ab left join zen_zones z on (ab.entry_zone_id = z.zone_id) left join zen_countries co on (ab.entry_country_id = co.countries_id) ) where c.customers_id = '2' and ab.customers_id = '2' and c.customers_default_address_id = ab.address_book_id]
    I tracked it down to the parentheses around the phrase following "from zen_customers c, ". I removed them from includes/classes/order.php and it works now.

    Here is the output of 'diff -ub', hopefully it won't wrap too badly:
    PHP Code:
    --- order.php-dist      2006-05-25 22:10:07.000000000 -0800
    +++ order.php   2006-05-25 22:15:22.000000000 -0800
    @@ -235,+235,@@
                                         
    z.zone_nameco.countries_idco.countries_name,
                                         
    co.countries_iso_code_2co.countries_iso_code_3,
                                         
    co.address_format_idab.entry_state
    -                                   from " . TABLE_CUSTOMERS . " c, (" . TABLE_ADDRESS_BOOK . " ab
    +                                   from " . TABLE_CUSTOMERS . " c" . TABLE_ADDRESS_BOOK . " ab
                                        left join 
    " . TABLE_ZONES . " z on (ab.entry_zone_id z.zone_id)
    -                                   
    left join " . TABLE_COUNTRIES . " co on (ab.entry_country_id co.countries_id) )
    +                                   
    left join " . TABLE_COUNTRIES . " co on (ab.entry_country_id co.countries_id
                                        
    where c.customers_id '" . (int)$_SESSION['customer_id'] . "'
                                        
    and ab.customers_id '" . (int)$_SESSION['customer_id'] . "'
                                        
    and c.customers_default_address_id ab.address_book_id"; 

    I hope that helps someone else! It would probably be a good candidate for the code base too but I don't know who is in charge of that :)

    -n

  2. #2
    Join Date
    Apr 2006
    Posts
    4
    Plugin Contributions
    0

    Default Re: SQL syntax bug in order.php with fix/patch for older MySQL

    oh yeah - what is the preferred method for submitting patches?

    -n

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

    Default Re: SQL syntax bug in order.php with fix/patch for older MySQL

    this is peculiar ... those parentheses were added to support MySQL 5
    .

    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.

  4. #4
    Join Date
    Apr 2006
    Posts
    4
    Plugin Contributions
    0

    Default Re: SQL syntax bug in order.php with fix/patch for older MySQL

    rats, I wish I had a MySQL 5 server to experiment with and find a happy compromise.

 

 

Similar Threads

  1. v139h Upload SQL Patch via phpMyAdmin in MySQL INSTEAD OF Amin-Tools-Install AQL patch ????
    By shags38 in forum Customization from the Admin
    Replies: 11
    Last Post: 20 Aug 2012, 04:19 AM
  2. v150 I was hoping to fix this problem with the SQL patch uploader.
    By sammirah in forum Upgrading to 1.5.x
    Replies: 11
    Last Post: 8 Apr 2012, 07:25 PM
  3. Replies: 6
    Last Post: 1 Oct 2011, 03:16 PM
  4. Migrating to server with older php & sql
    By Nipple in forum Installing on a Linux/Unix Server
    Replies: 3
    Last Post: 25 Apr 2008, 04:48 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