Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2005
    Posts
    15
    Plugin Contributions
    0

    Default Problem with MySQL 5 - 1054 Unknown column 'p.products_id' in 'on clause'

    Our web host just upgraded mysql from 4 to 5 without ever informing us, and our zencart site is pretty much dead. I'm running a hacked up version of zencart 1.2.5, and today I'm getting the following error:

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

    At first I was getting this when clicking on a category or a product. I made some changes in the includes\index_filters\default_filter.php and my categories are showing up, but when I click on a product to view the product details, I still get the same error. I don't know which query is creating the problem on this page and would appreciate it if someone can tell me which query i need to fix. Upgrading the site to the latest version of zencart at this time is out of the question because we have too many custom hacks and it would take a major effort.

    The main site is at http://www.tmpanime.com. If you click on any product, you will get the above SQL error. I'm getting very frustrated because I get no debug info that gives me any clue on which query in what file is causing this. Thanks much.

  2. #2
    Join Date
    Mar 2004
    Posts
    16,042
    Plugin Contributions
    5

    Default Re: Problem with MySQL 5 - 1054 Unknown column 'p.products_id' in 'on clause'

    Its most of em,

    for mysql 5 you really need to be running at least 1.3.6 but 1371 or 138 would be much better,
    Zen cart PCI compliant Hosting

  3. #3
    Join Date
    Jul 2005
    Posts
    15
    Plugin Contributions
    0

    Default Re: Problem with MySQL 5 - 1054 Unknown column 'p.products_id' in 'on clause'

    Thanks for the reply, but as of now, it's going to be impossible for me to do an upgrade because we have too many hacks on the site. Like I said, I got the main category listings to work and I just need to get the product info page working. If you can please point me to the actual files that have the queries, I'll figure out the changes. I can't seem to track down the actual queries that makeup the page.

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

    Default Re: Problem with MySQL 5 - 1054 Unknown column 'p.products_id' in 'on clause'

    You said you're using v1.2.5.
    There's no patch available for 1.2.5 directly.
    But someone posted a patch a long time ago to work with v1.2.6 and MySQL 5.
    You *might* find it of partial value in mending some queries.
    Keep in mind that the patch only deals with some of the more common queries. There are a lot more "fixes" to MySQL queries esp in the admin ... in the v1.3 code.

    Patch for v1.2.6: http://download.dataweb.no/files/zen...h-zc1.2.6d.zip
    **Use at own risk**
    .

    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.

  5. #5
    Join Date
    Jul 2005
    Posts
    15
    Plugin Contributions
    0

    Default Re: Problem with MySQL 5 - 1054 Unknown column 'p.products_id' in 'on clause'

    Thank you, thank you, thank you, thank you!!! That did the trick for now. I guess I'm gonna be upgrading to the latest version this weekend.

  6. #6
    Join Date
    Feb 2005
    Posts
    246
    Plugin Contributions
    0

    Default Re: Problem with MySQL 5 - 1054 Unknown column 'p.products_id' in 'on clause'

    My hosting provider gave me some notes and I had to edit them to make them work. This worked on zc 1.2.1

    USE WITH CAUTION!! I have no idea what complications this may cause, and if there are any other MySQL5 errors, this won't fix them.

    Look in includes/index_filters/default_filter.php

    Find this...
    PHP Code:

        
    // show the products of a specified manufacturer
           
    if (isset($_GET['manufacturers_id'])) {
             if (isset(
    $_GET['filter_id']) && tep_not_null($_GET['filter_id'])) {
        
    // We are asked to show only a specific category
               
    $listing_sql "select " $select_column_list " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " TABLE_PRODUCTS " p, " TABLE_PRODUCTS_DESCRIPTION " pd, " TABLE_MANUFACTURERS " m, " TABLE_PRODUCTS_TO_CATEGORIES " p2c left join " TABLE_SPECIALS " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$_GET['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id "' and p2c.categories_id = '" . (int)$_GET['filter_id'] . "'";
             } else {
        
    // We show them all
               
    $listing_sql "select " $select_column_list " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " TABLE_PRODUCTS " p, " TABLE_PRODUCTS_DESCRIPTION " pd, " TABLE_MANUFACTURERS " m left join " TABLE_SPECIALS " s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$_GET['manufacturers_id'] . "'";
             }
           } else {
        
    // show the products in a given categorie
             
    if (isset($_GET['filter_id']) && zen_not_null($_GET['filter_id'])) {
        
    // We are asked to show only specific catgeory
               
    $listing_sql "select " $select_column_list " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " TABLE_PRODUCTS " p, " TABLE_PRODUCTS_DESCRIPTION " pd, " TABLE_MANUFACTURERS " m, " TABLE_PRODUCTS_TO_CATEGORIES " p2c left join " TABLE_SPECIALS " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$_GET['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id "' and p2c.categories_id = '" . (int)$current_category_id "'";
             } else {
        
    // We show them all
               
    $listing_sql "select " $select_column_list " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " TABLE_PRODUCTS_DESCRIPTION " pd, " TABLE_PRODUCTS " p left join " TABLE_MANUFACTURERS " m on p.manufacturers_id = m.manufacturers_id, " TABLE_PRODUCTS_TO_CATEGORIES " p2c left join " TABLE_SPECIALS " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id "' and p2c.categories_id = '" . (int)$current_category_id "'";
             }
           }
        ------------------------------------- 
    and replace with this
    PHP Code:
            // show the products of a specified manufacturer
        
    if (isset($_GET['manufacturers_id']) && $_GET['manufacturers_id'] != '' ) {
        if (isset(
    $_GET['filter_id']) && zen_not_null($_GET['filter_id'])) {
        
    // We are asked to show only a specific category
        
    $listing_sql "select " $select_column_list " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from (" TABLE_PRODUCTS " p, " TABLE_PRODUCTS_DESCRIPTION " pd, " TABLE_MANUFACTURERS " m, " TABLE_PRODUCTS_TO_CATEGORIES " p2c ) left join " TABLE_SPECIALS " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$_GET['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id "' and p2c.categories_id = '" . (int)$_GET['filter_id'] . "'";
        } else {
        
    // We show them all
        
    $listing_sql "select " $select_column_list " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from (" TABLE_PRODUCTS " p, " TABLE_PRODUCTS_DESCRIPTION " pd, " TABLE_MANUFACTURERS " m) left join " TABLE_SPECIALS " s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$_GET['manufacturers_id'] . "'";
        }
        } else {
        
    // show the products in a given categorie
        
    if (isset($_GET['filter_id']) && tep_not_null($_GET['filter_id'])) {
        
    // We are asked to show only specific catgeory
        
    $listing_sql "select " $select_column_list " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from (" TABLE_PRODUCTS " p, " TABLE_PRODUCTS_DESCRIPTION " pd, " TABLE_MANUFACTURERS " m, " TABLE_PRODUCTS_TO_CATEGORIES " p2c) left join " TABLE_SPECIALS " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$_GET['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id "' and p2c.categories_id = '" . (int)$current_category_id "'";
        } else {
        
    // We show them all
        
    $listing_sql "select " $select_column_list " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from ((" TABLE_PRODUCTS_DESCRIPTION " pd, " TABLE_PRODUCTS " p) left join " TABLE_MANUFACTURERS " m on p.manufacturers_id = m.manufacturers_id, " TABLE_PRODUCTS_TO_CATEGORIES " p2c) left join " TABLE_SPECIALS " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id "' and p2c.categories_id = '" . (int)$current_category_id "'";
        }
        } 

 

 

Similar Threads

  1. Replies: 0
    Last Post: 7 Apr 2008, 04:53 AM
  2. 1054 Unknown column 'p.products_id' in 'on clause' ???
    By cmb1998 in forum General Questions
    Replies: 1
    Last Post: 27 Aug 2007, 11:48 PM
  3. 1054 Unknown column 'p.products_id' in 'on clause'
    By tharrison in forum General Questions
    Replies: 9
    Last Post: 19 Jun 2007, 11:33 PM
  4. 1054 Unknown column 'p.products_id' in 'on clause'
    By yoster in forum Installing on a Windows Server
    Replies: 7
    Last Post: 2 Jun 2007, 04:41 AM
  5. 1054 Unknown column 'p.products_id' in 'on clause'
    By caradelrae in forum General Questions
    Replies: 8
    Last Post: 8 Oct 2006, 05:41 PM

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