Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

1064 - You have an error in your SQL syntax (shopping_cart.php)


Shams

Recommended Posts

Hi,

 

I have the latest version of oscommerce and I also applied the update patches. However, I have a problem with the shopping cart. When I try to add a product (that has no attributes) to my cart, no problem. But when I add a product with attributes to my cart, I get this error message in the shopping_cart.php page:

 

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 '/ Patch osc-060817 and pa.options_id = '9' at line 3

 

select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from products_options popt, products_options_values poval, products_attributes pa where pa.products_id = '148' // Patch osc-060817 and pa.options_id = '9' // Patch osc-060817 and pa.options_id = popt.products_options_id and pa.options_values_id = '37' // Patch osc-060817 and pa.options_values_id = poval.products_options_values_id and popt.language_id = '1' // Patch osc-060817 and poval.language_id = '1'

 

Although the product is displayed correctly in the shopping_cart box.

I really don't know how to fix this. Please help.

 

Thank You.

Link to comment
Share on other sites

go back an re-check the install instructions. You should not add the comments of the patch into the code (those strings preceded with //)

Link to comment
Share on other sites

Hello creator of this contribution,

 

 

 

when i click the products i got this problem.

 

 

1064 - You have an error in your SQL syntax near '((products p left join manufacturers m on p.manufacturers_id = m.manufacturers_i' at line 1

 

select pd.products_name, p.products_model, p.products_image, p.products_id, p.manufacturers_id, p.products_price, p.products_weight, p.products_qty_blocks, p.products_tax_class_id, p.distributors_id, IF(s.status = '1' AND s.stores_id = '1', s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status = '1' AND s.stores_id = '1', s.specials_new_products_price, p.products_price) as final_price from products_to_categories p2c, ((products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_description pd) left join specials s on p.products_id = s.products_id and s.stores_id = '1') INNER JOIN products_to_stores p2s ON p.products_id = p2s.products_id where p2s.stores_id = '1' AND p.products_status = '1' and p.products_id = '1' and pd.products_id = '1' and pd.language_id = '1'

 

[TEP STOP]

 

 

can anyone help me?

 

Many thanks.

 

Dice :'(

my signature

Link to comment
Share on other sites

  • 7 months later...

Well I found out the same thing as Shams; adding item that has attributes to shopping cart

same 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 '/ Patch osc-060817 and pa.options_id

 

Thanks to enigma1 for posting the solution ~ but I never found any instructions that mentioned removing those comments from the code.

 

  $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix
								  from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
								  where pa.products_id = '" . (int)$products[$i]['id'] . "' // Patch osc-060817
								   and pa.options_id = '" . (int)$option . "' // Patch osc-060817
								   and pa.options_id = popt.products_options_id
								   and pa.options_values_id = '" . (int)$value . "' // Patch osc-060817
								   and pa.options_values_id = poval.products_options_values_id
								   and popt.language_id = '" . (int)$languages_id . "' // Patch osc-060817
								   and poval.language_id = '" . (int)$languages_id . "'"); // Patch osc-060817
	  $attributes_values = tep_db_fetch_array($attributes);

Same solution just remove all the...

// Patch osc-060817

...and that fixes it.

 

I used http://addons.oscommerce.com/info/4691 and read through the suggested thread at http://www.oscommerce.com/forums/index.php?showtopic=223556

but found nothing about comments running into, disturbing, or being removed from the code.

 

I post here in a tired old thread because when I Googled my error, this is where I landed. Doesn't that make more sense than adding a (junk post) to the contribution?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...