Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Error when removing manufacturer filter


Guest

Recommended Posts

Posted

i have a site in dev with a template that seems to be working fine, with one minor exception. when i filter by manufacturer, everything works fine. however, when i remove the filter (i.e., return to 'Please Select' in the manufacturer filter), i get the following 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 'LIMIT 0, 30' at line 1
SELECT manufacturers_name FROM manufacturers WHERE manufacturers_id = LIMIT 0, 30 
[TEP STOP]

 

i performed a 'search files' and the only place this code shows up is in index.php, and the code is as follows:

 

$cat='SELECT manufacturers_name FROM '. TABLE_MANUFACTURERS .' WHERE manufacturers_id = '.$HTTP_GET_VARS['manufacturers_id'].' LIMIT 0, 30 ';
$cat=tep_db_query($cat);
$cat = tep_db_fetch_array($cat);
echo $cat['manufacturers_name'];

 

since there isn't an error as long as there's a filter in place (i.e., i can change from manufacturer #1 to manufacturer #2 with no issues), i'm pretty sure the error relates to the 'Please Select' not being listed in the manufacturers table, but not sure how to write the code to resolve. thinking something like, <if null, link to specials.php>. any ideas?

Posted

also, i've tried modifying both split_page_results pages based on the suggested bug fix - this isn't the problem. thanks!

Posted

thought maybe it would help if i posted the entire code:

 

//show category name

if (!isset($HTTP_GET_VARS['manufacturers_id']))

{

$cat='SELECT categories_id, language_id , categories_name FROM categories_description WHERE categories_id = '.(int)$current_category_id.' AND language_id = '.(int)$languages_id.' LIMIT 0, 30 ';

$cat=tep_db_query($cat);

$cat = tep_db_fetch_array($cat);

echo $cat['categories_name'];

}

else

{

$cat='SELECT manufacturers_name FROM '. TABLE_MANUFACTURERS .' WHERE manufacturers_id = '.$HTTP_GET_VARS['manufacturers_id'].' LIMIT 0, 30 ';

$cat=tep_db_query($cat);

$cat = tep_db_fetch_array($cat);

echo $cat['manufacturers_name'];

}

Archived

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

×
×
  • Create New...