Forums / Installing on a Windows Server / 1054 Unknown column 'p.products_id' in 'on clause'

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

Locked

Views: 3,791

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
4 Apr 2007, 3:18 PM
#1
yoster avatar

yoster

New Zenner

Join Date:
Mar 2007
Posts:
12
Plugin Contributions:
0

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

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

This is what i get after i try to add any product to any category

I am using the basic template that come with the shopping cart

Can anyone point me in the right direction?
What code and where do i need to put tem to fix this?

  1. Before you criticize someone, walk a mile in his shoes. That way, if he gets angry, he'll be a mile way - and barefoot.
  2. A tree never hits an automobile except in self defense
  3. Genius is one percent inspiration and ninety-nine percent perspiration.
5 Apr 2007, 1:45 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

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

What version of Zen Cart are you using?
What version of PHP ?
What version of MySQL ?
Have you installed any contributions/mods/customizations, whether related to template or not?

That's a typical problem with MySQL 5 and older versions of Zen Cart or older contributions.

.
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.

29 Apr 2007, 5:09 PM
#3
marcoden avatar

marcoden

New Zenner

Join Date:
Mar 2006
Posts:
5
Plugin Contributions:
0

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

I'm still using Zen Cart v1.2.7 and I solved this problem by fixing one query in the includes/modules/meta_tags.php:

Find (around line 181):

case (strstr($_GET['main_page'], 'product_') or strstr($_GET['main_page'], 'document_')):
    $sql= "select pd.products_name, p.products_model, p.products_price_sorter, p.products_tax_class_id,
                                      p.metatags_title_status, p.metatags_products_name_status, p.metatags_model_status,
                                      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'] . "'
                              where p.products_id = '" . (int)$_GET['products_id'] . "'
                              and p.products_id = pd.products_id
                              and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";

change to:

case (strstr($_GET['main_page'], 'product_') or strstr($_GET['main_page'], 'document_')):
    $sql= "select pd.products_name, p.products_model, p.products_price_sorter, p.products_tax_class_id,
                                      p.metatags_title_status, p.metatags_products_name_status, p.metatags_model_status,
                                      p.products_id, p.metatags_price_status, p.metatags_title_tagline_status,
                                      pd.products_description, p.product_is_free,
                                      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'] . "'
                              where p.products_id = '" . (int)$_GET['products_id'] . "'
                              and p.products_id = pd.products_id
                              and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";

Regards.

29 Apr 2007, 5:47 PM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

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

thanks MARcoDEN, but in this case, the cause has nothing to do with meta-tags.

.
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.

13 May 2007, 4:40 AM
#5
emmdee avatar

emmdee

New Zenner

Join Date:
Nov 2005
Posts:
40
Plugin Contributions:
0

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

Can you tell me Dr Byte what you think it has to do with??
1054 Unknown column 'p.products_id' in 'on clause'
I'm getting the same error on v 1.2.7 locally iis on XP mysql 5.0
Regards
emmdee

13 May 2007, 7:47 AM
#6
chuckl avatar

chuckl

Totally Zenned

Join Date:
Nov 2006
Location:
Papworth, Cambridgeshire, UK
Posts:
717
Plugin Contributions:
0

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

it has to do with running version 1.2.7 with MySQL 5. Not impossible to fix, but probably easier to use version 1.3.7? Version 1.2.7 is just so last year.
Seriously, MySQL 5 has a my.ini setting to behave more like version 4.x. In my.ini look for a sql-mode flag and change to sql-mode="MYSQL40", or disable strict mode.
A search on the forums here for 1054 will probably bring up a lot of fixesas well, although 1.2.7 results may be in the archived section.

23 May 2007, 8:00 PM
#7
foxdeluxe avatar

foxdeluxe

New Zenner

Join Date:
Jun 2004
Posts:
32
Plugin Contributions:
0

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

I'm still running 1.2.7 and encountered this problem for the first time today.
My host says they upgraded to MySQL 5.0 back in October.
If that's the case, wouldn't the problem have occurred much sooner?

2 Jun 2007, 3:41 AM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

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

In theory yes. Perhaps it "has" been occurring in limited ways but nobody has reported it to you.

However, if your hosting company did the upgrade but did not enable the MySQL5 "strict-trans-tables" setting (and another problematic one), then you may not be bitten by the sting of the stricter construction requirements.

Either way, you should be planning an upgrade sooner than later...

.
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.