Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Error 1054, 1064 and MySQL


lld4ll

Recommended Posts

Hello,

 

I have problem vith my http://opter.ee/epood/ - Computer Store site.

 

Skinn name is Template Monster 9005

 

 

 

Sorry my bad english, but problem was stated @ 1054 - Unknown column 'p.products_id' in 'on clause'

 

 

I try to repare this, but it dosent help me

Error was:

 

1054 - Unknown column 'p.products_id' in 'on clause' select count(p.products_id) as total from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join 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 = '4' and p2c.categories_id = '32'

http://www.oscommerce.com/community/contributions,4654

http://www.oscommerce.com/forums/topic/230304-1054-unknown-column-pproducts-id-in-on-clause/page__st__40

 

 

32 - is Category what i was called to "Arvutid"

 

 

1. i remove that category but when i click this link:

http://opter.ee/epood/specials.php

I got this error:

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 '-6, 6' at line 1

 

 

 

Oky, i replace all changed file to back and start over.

 

When i try again to change advanced_search_result.php

 

Then i got some line error 175 "} else {"

When i remove "{" then that error is gone, but replaced to header.php line 59, and when i replace that to, then all error is gone but if i add some product, then i got allots of adminpanel errors.

 

dead sircle. Newest OSC is working fine, but there wasnt themes what i like (9005)

 

Please help to fix this error.

 

and there was a link FULL (without database username and pass) my store files:

http://opter.ee/osc.zip

 

by Thomas

 

Thanx

Link to comment
Share on other sites

Thomas,

 

 

That is an OLD template. It was based on version 2.2

 

The contributions you tried to install may be incompatible with older versions of OSC.

 

I would get your money back from template monster, they should not be selling V2.2 oscommerce templates.

 

 

 

Chris

Link to comment
Share on other sites

Thomas,

 

 

That is an OLD template. It was based on version 2.2

 

The contributions you tried to install may be incompatible with older versions of OSC.

 

I would get your money back from template monster, they should not be selling V2.2 oscommerce templates.

 

 

 

Chris

 

 

Thanx Chris,

 

I know its old template, but i want to get it work.

There must be some litle php5 and MySQL errors, because when i change p.products_id to p2c.products_id then error 1054 is gone.

but special still show me 1064 and "Arvutid" / "Computers" show errorline 59 that means "}"

You just need to change one section in index.php and one in advance search_result.php.

but what section? is that p to p2c or what?

 

 

I found this threads:

http://www.oscommerce.com/forums/index.php?showtopic=335136&hl=

did i must to try this to?

 

 

Index.php

// show the products of a specified manufacturer

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['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)$HTTP_GET_VARS['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)$HTTP_GET_VARS['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)$HTTP_GET_VARS['manufacturers_id'] . "'";

}

} else {

// show the products in a given categorie

Last line was 175 "} else {"

 

When i change all p.products_id to p2c.products_id then error gone but 1064 in special section is still there.

 

Can you help me? (Im student and we havnt yet study php, only c++ blood dev and its look similar.

 

 

Tanx

Link to comment
Share on other sites

For the 1054 problem, read this: http://www.oscommerce.com/forums/topic/335136-osc-and-mysql-5-1054-errors . It describes the "why" and most of the "wheres" of what the problem is. For the specific example you give, you need to find the PHP code that produces this query and add some ( ) around the list of tables to the left of a JOIN statement:

select count(p.products_id) as total from products_description pd, products p left join
manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join
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 = '4' and 
p2c.categories_id = '32'

becomes

select count(p.products_id) as total from ((products_description pd, products p) left join
manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c) left join 
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 = '4' and 
p2c.categories_id = '32'

That code looks vaguely familiar -- it may be listed in the referenced append.

 

For the 1064 problem, sometimes osC generates a negative starting row number for a LIMIT statement (-6 in this case). The solution has been discussed before, many times, and the solution is to change code similar to

...LIMIT " . $start_row . ", " . $num_rows...

to

...LIMIT " . max(0,$start_row) . ", " . $num_rows...

I don't know if there is any place that someone has gathered together all the fixes needed. Note that this was fixed quite a while ago, so you must be using a quite old version of osC.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...