Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

New product sql error


mjump

Recommended Posts

Posted

I am new to oscommerce and have spent a lot of time search this through the forums and cannot find a solution..

 

On a site i inherited I am trying to upgrade to a cleaner look and newest version of the product.

 

I get this occurrent periodically when a category has a lot of items and also tries to display a listing of new products.

 

In the new_products.php file if I remove this statement the page displays fine and there is a list of items without any "header" over it

 

	$sql = 'SELECT `manufacturers_name` FROM `manufacturers` WHERE manufacturers_id ='.$new_products['manufacturers_id'];
$manufacturers_query = tep_db_query($sql);
$manufacturers = mysql_fetch_array($manufacturers_query, MYSQL_ASSOC);        
if($manufacturers['manufacturers_name']!='')
$manufacturers['manufacturers_name']=' by '.$manufacturers['manufacturers_name'];  

 

If I leave it, I get a display of categories as expected and where the display of new products is expected I get this:

 

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 `manufacturers_name` FROM `manufacturers` WHERE manufacturers_id =

 

[TEP STOP]

 

 

 

I have checked the database and the items are all listed in the table... I have seen some notes about modifying the split_page_results.php file to correct other errors, but am not sure they apply to this and I don't like modifying anything just on a whim.

 

I am running osCommerce 2.2-MS2 and php4.4.4.

 

Any help or direction to a finding a solution would be appreciated

Posted
I am running osCommerce 2.2-MS2 and php4.4.4.

 

Dont know about the code you gave - it is not default for osC 2.2 - we are talikning about page 'catalog/includes/modules/new_products.php' right??

 

Try this:

$sql = 'SELECT `manufacturers_name` FROM `manufacturers` WHERE manufacturers_id = ' . (int)$new_products['manufacturers_id'];

 

I inserted a space after the equal sign and added the (int) function. May just need a space not the function - I do not know what type of values the array $new_products holds..

Lloyd

Archived

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

×
×
  • Create New...