Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Format MySQL 4 query to MySQL 5


thp

Recommended Posts

Hello all,

 

I have recently purchased a Templatemonster osCommerce Template. Unfortunately, all their templates are based on having MySQL v4x. Our Servers use v5x.

 

I was getting many 1054 - Unknown column 'p.products_id' in 'on clause' errors in my index page but have fixed all of them except one, thanks to previous Forum Member posts.

 

However, for this design, the Template Designer has added their own SQL statements for the Homepage. This shows the output of two selected categories. The design can be viewed at http://osc.template-help.com/10257/index.php

 

To show each of the categories (will use one category, other is the same with exception of category id), they have entered the following SQL statement;

 

$current_category_id = 54;

$listing_sql = "select p.products_image, pd.products_name, 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 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 = '1' and p2c.categories_id = '".$current_category_id."' order by p.products_date_added DESC limit 3";

$new_products_query = tep_db_query($listing_sql);

 

The statement is followed by the PHP code, which I don't think is contributing to the 1054 error message.

 

Can anyone please help with reformatting the above MySQL statement to MySQL v5?

 

Regards

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...