geepeetee Posted August 31, 2010 Posted August 31, 2010 Hi, I have added a couple of new fields and all seems well except on the product listing page. Clicking on product name or price will sort by those columns no problem. But when sorting by the fields I added it comes up with 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 'p.products_app , pd.products_name' at line 1 select count(distinct p.products_id) as total from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join specials s on p.products_id = s.products_id, products_to_categories p2c 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 = '49' or p2c.categories_id = '50' or p2c.categories_id = '51' or p2c.categories_id = '52' or p2c.categories_id = '53' or p2c.categories_id = '54' or p2c.categories_id = '55' or p2c.categories_id = '56' or p2c.categories_id = '57' or p2c.categories_id = '58' or p2c.categories_id = '59' or p2c.categories_id = '60' or p2c.categories_id = '61' or p2c.categories_id = '28')p.products_app , pd.products_name [TEP STOP] I am stumped as to how this can be fixed. Thanks, Gareth
roya.k Posted August 31, 2010 Posted August 31, 2010 Hi, I have added a couple of new fields and all seems well except on the product listing page. Clicking on product name or price will sort by those columns no problem. But when sorting by the fields I added it comes up with 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 'p.products_app , pd.products_name' at line 1 select count(distinct p.products_id) as total from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join specials s on p.products_id = s.products_id, products_to_categories p2c 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 = '49' or p2c.categories_id = '50' or p2c.categories_id = '51' or p2c.categories_id = '52' or p2c.categories_id = '53' or p2c.categories_id = '54' or p2c.categories_id = '55' or p2c.categories_id = '56' or p2c.categories_id = '57' or p2c.categories_id = '58' or p2c.categories_id = '59' or p2c.categories_id = '60' or p2c.categories_id = '61' or p2c.categories_id = '28')p.products_app , pd.products_name [TEP STOP] I am stumped as to how this can be fixed. Thanks, Gareth you may need to add an order by statement like this : .....or p2c.categories_id = '28') ORDER BY p.products_app , pd.products_name Open source n'est pas un échange à sens unique ... La plupart du temps un simple merci ou quelques mots d'encouragement suffisent...
geepeetee Posted September 1, 2010 Author Posted September 1, 2010 Brilliant, this fixed the problem. Thanks for your help.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.