JemCraft Posted October 11, 2006 Posted October 11, 2006 I am trying to solve the problem of all my products being listed in the New Products section of my website. I am using the oscommerce knowledgebase fix here. It says In catalog/products_new.php about line 56 find this code: $Qproducts = $osC_Database->query('select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from :table_products p left join :table_manufacturers m on (p.manufacturers_id = m.manufacturers_id), :table_products_description pd where p.products_status = 1 and p.products_id = pd.products_id and pd.language_id = :language_id order by p.products_date_added desc, pd.products_name'); Change to: $Qproducts = $osC_Database->query('select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from :table_products p left join :table_manufacturers m on (p.manufacturers_id = m.manufacturers_id), :table_products_description pd where p.products_status = 1 and p.products_id = pd.products_id and pd.language_id = :language_id and month(p.products_date_added) = month(now()) and year(p.products_date_added) = year(now()) order by p.products_date_added desc, pd.products_name'); However my catalog products_new.php says $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name"; I have tried inserting and month(p.products_date_added) = month(now()) and year(p.products_date_added) = year(now() after the and pd.language_id = '" . (int)$languages_id . "' however I get the following error on the new products page of my site: 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 '' at line 1 select count(*) as total from products p left join manufacturers m on (p.manufacturers_id = m.manufacturers_id), products_description pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1'and month(p.products_date_added) = month(now()) and year(p.products_date_added) = year(now() [TEP STOP] Can anyone help? Please?! Many thanks Jemma
pyramids Posted October 12, 2006 Posted October 12, 2006 first guess (not really looking at it) is you need a space before the and in --- '1'and so it will be --- '1' and your code select count(*) as total from products p left join manufacturers m on (p.manufacturers_id = m.manufacturers_id), products_description pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1'and month(p.products_date_added) = month(now()) and year(p.products_date_added) = year(now()
JemCraft Posted October 12, 2006 Author Posted October 12, 2006 There was a ) missing from the very end!!! Simple as that. Well it's simple now!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.