Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

SQL Syntax Error?


gwynwyffar

Recommended Posts

I am running a heavily modified version of RC2a and everything has been working fine so far until I encountered a product subcategory with more than 20 products. When I'm in the catalog and click the "Next" link to see the rest of the products in the category I receive 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_sort_order , pd.products_name asc' at line 1

 

select count(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_retail_prices 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 = '22'p.products_sort_order , pd.products_name asc

 

I don't even know where to begin to look to correct this error.

Server is running:

HTTP Server: Apache/2.2.8

PHP Version: 5.2.5 (Zend: 2.2.0)

Database: MySQL 5.0.45

 

You can see the error by clicking Next from this page http://www370.pair.com/jcristal/catalog/in...php?cPath=21_22 (this site is on a live server but is not live for orders yet)

 

I suspect it may have to do with the Product Sort Order contribution I installed to allow products to be displayed in a specific order. This may be the offending code in index.php

	  //sort order
			if ($column_list[$i] == 'PRODUCT_LIST_SORT_ORDER') {
			  $HTTP_GET_VARS['sort'] = $i+1 . 'a';
			  $listing_sql .= " order by p.products_sort_order, pd.products_name";

			  break;
			}
			elseif ($column_list[$i] == 'PRODUCT_LIST_NAME' && PRODUCT_LIST_SORT_ORDER==0) {
			  $HTTP_GET_VARS['sort'] = $i+1 . 'a';
			  $listing_sql .= " order by pd.products_name";
	//end sort order

 

but I'm not enough of a MySQL expert to know what to do here to correct it.

Link to comment
Share on other sites

I found the problem, there was a punctuation in one of the changes made by the Product Sort Order contribution. I've fixed it and uploaded the correction to the contribution page.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...