Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

SQL Syntax Error


md1

Recommended Posts

I have had a problem with a SQL Syntax error for some time now but despite a number of posts I have been unable to find the problem.

 

I don't think it is data related brcause I can empty my product files and I still have the problem. I need to understand how Oscommerce works with the SQL database so that I can try some debugging.

 

I get this error when I do a search or try to list a category.

 

It appears to be replacing ' with \'

 

The error is as follows. Any help appreciated.

 

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 'select p.products_image, p.products_quantity, pd.products_name,

 

select count(select p.products_image, p.products_quantity, 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 = \'32\' order by pd.products_name) as total

 

Regards

Mark

Link to comment
Share on other sites

I shall try a post at the MYSQL forum but I think it is a osCommerce problem. The syntax is incorrect because something in osCommerce is changing the syntax by replacing ' with /'

 

Regards

Mark

Link to comment
Share on other sites

I have so many osC sites I've lost count, and don't have that problem - so it's specific to what you are trying to do and how you're doing it.

 

Even in the db when you have text inserted, for instance in the products_description field, the use of apostrophies still has to be escaped by a backslash - because it pulls the text from the database for display on the page and if an apostrophy is not escaped with a backslash this will generate an onpage Parse Error.

 

Looking at your code I don't understand why the apostrophies are there in the first place, but as long as they are there then the addslashes command will be applied to prevent parse errors from occuring.

 

Vger

Link to comment
Share on other sites

I have had a problem with a SQL Syntax error for some time now but despite a number of posts I have been unable to find the problem.

 

I don't think it is data related brcause I can empty my product files and I still have the problem.  I need to understand how Oscommerce works with the SQL database so that I can try some debugging.

 

I get this error when I do a search or try to list a category.

 

It appears to be replacing ' with \'

 

The error is as follows.  Any help appreciated.

 

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 'select p.products_image, p.products_quantity, pd.products_name,

 

select count(select p.products_image, p.products_quantity, 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 = \'32\' order by pd.products_name) as total

 

Regards

Mark

 

 

I'm actually having the same problem with my store as well. Have anyone found a fix for this as of yet?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...