Thread: SQL Error

Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2006
    Posts
    32
    Plugin Contributions
    0

    Default SQL Error

    Recently installed the latest version of Zen Cart on the following setup:

    FreeBSD 6.1
    PHP 5.1.2
    MySQL 5.1.2

    Install went as expected, but the product page shows nothing but a SQL error:

    1054 - Unknown column 'p.products_id' in 'on clause'

    I did a little research on the web and found this thread regarding the same error in osCommerce:

    http//www.oscommerce.com/community/bugs,3171/category,Installation+&+Configuration

    where I learned about the new, stricter JOIN syntax. I then made the following changes to includes/modules/meta_tags.php :

    Code:
    > diff -Nu meta_tags.php.old meta_tags.php
    --- meta_tags.php.old   Mon Jun 12 03:19:12 2006
    +++ meta_tags.php       Mon Jun 12 03:17:59 2006
    @@ -161,7 +161,7 @@
                                           p.products_id, p.metatags_price_status, p.metatags_title_tagline_status,
                                           pd.products_description,
                                           mtpd.metatags_title, mtpd.metatags_keywords, mtpd.metatags_description
    -                              from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . " mtpd on mtpd.products_id = p.products_id and mtpd.language_id = '" . (int)$_SESSION['languages_id'] . "'
    +                              from (" . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd) left join " . TABLE_META_TAGS_PRODUCTS_DESCRIPTION . " mtpd on mtpd.products_id = p.products_id and mtpd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                                   where p.products_id = '" . (int)$_GET['products_id'] . "'
                                   and p.products_id = pd.products_id
                                   and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";
    And the product page now displays correctly without the error. I assume this JOIN syntax bug exists elsewhere in the code base and will show itself in MySQL 5 installations. However, my Zen Cart experience has lasted about 30 minutes thus far.
    Last edited by DrByte; 12 Jun 2006 at 07:48 PM. Reason: remove active link to external site

  2. #2
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: SQL Error

    Thanks for the feedback.

    I'm not sure where you got your "latest" code for Zen Cart, because the suggestion you posted was fixed in the v1.3.0 release. In the code you'll notice it starting on line 180.

    You are looking at v1.2.7 code. A number of MySQL5-compatibility fixes were implemented in v1.3.x. The latest version can be obtained by clicking the "Get Zen Cart" link at the top of this page.
    .

    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.

  3. #3
    Join Date
    Jun 2006
    Posts
    32
    Plugin Contributions
    0

    Default Re: SQL Error

    Ahhh... the Zen Cart project on FreshMeat needs to be updated.

 

 

Similar Threads

  1. v139h DB/SQL Error when using SQL Patch for Add Pages More Info Sidebox addon
    By maperr55 in forum All Other Contributions/Addons
    Replies: 6
    Last Post: 5 Mar 2012, 09:32 PM
  2. Replies: 1
    Last Post: 25 Aug 2011, 05:58 AM
  3. 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
  4. 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
  5. 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

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