rdranoel Posted February 17, 2009 Share Posted February 17, 2009 I installed this add-on (Short Description in products): osCommerce Community Add-Ons It occurs in catalog/includes/modules/product_listing.php When I paste this code into the file: $sql = 'SELECT `products_description` FROM `products_description` WHERE products_id ='.$listing['products_id'].' && language_id='.(int)$languages_id; $description_query = tep_db_query($sql); $description = mysql_fetch_array($description_query, MYSQL_ASSOC); $description['products_description'] = substr($description['products_description'], 0, 200); $desc_len = strlen($description['products_description']); $description['products_description'][$desc_len-1] = '.'; $description['products_description'][$desc_len-2] = '.'; $description['products_description'][$desc_len-3] = '.'; And now I am getting 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 '&& language_id=1' at line 1 SELECT `products_description` FROM `products_description` WHERE products_id = && language_id=1 [TEP STOP] Can anyone see what's wrong with the code block above? Our web site is here: Sound Approach I have turned off SEO, applied numerous patches to fix the problem- but to no avail. Does any one have any thoughts how-to correct the error. I've spent the last 3+ hours searching for a solution. Thanks for any advice Dale Quote Link to comment Share on other sites More sharing options...
♥geoffreywalton Posted February 17, 2009 Share Posted February 17, 2009 $listing['products_id'] is blank. It is not the sql. Quote Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile Virus Threat Scanner My Contributions Basic install answers. Click here for Contributions / Add Ons. UK your site. Site Move. Basic design info. For links mentioned in old answers that are no longer here follow this link Useful Threads. If this post was useful, click the Like This button over there ======>>>>>. Link to comment Share on other sites More sharing options...
rdranoel Posted February 17, 2009 Author Share Posted February 17, 2009 $listing['products_id'] is blank. It is not the sql. Thanks, you are the man! With your tip that it was not an Sql issue- I made a slight code change: $sql = 'SELECT `products_description` FROM `products_description` WHERE products_id ='.$listing[$x]['products_id'].' && language_id='.(int)$languages_id; $description_query = tep_db_query($sql); $description = mysql_fetch_array($description_query, MYSQL_ASSOC); $description['products_description'] = substr($description['products_description'], 0, 500); $desc_len = strlen($description['products_description']); $description['products_description'][$desc_len-1] = '.'; $description['products_description'][$desc_len-2] = '.'; $description['products_description'][$desc_len-3] = '.'; And modified the secondary code as well: case 'PRODUCT_LIST_NAME': $lc_align = ''; if (isset($HTTP_GET_VARS['manufacturers_id'])) { $lc_text = '<b><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a></b><br>' . strip_tags($description['products_description']) . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . DESCR_READ_MORE . '</a>'; } else { $lc_text = ' <b><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a></b> <br>' . strip_tags($description['products_description']) . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . DESCR_READ_MORE . '</a>'; } break; Now it is working properly. Hope this helps others in the future. Dale Quote Link to comment Share on other sites More sharing options...
prvhk3 Posted March 26, 2013 Share Posted March 26, 2013 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 count(distinct p.products_date_added) as total from products p left join manufacturers m using(manufacturers_id) left join specials s on p.products_id = s.products_id, products_description pd, categories c, products_to_categories p2c, categories_description cd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.categories_id = cd.categories_id and ((pd.products_name like '%64%' or p.products_model like '%64%' or m.manufacturers_name like '%64%') I get this error if i search any thing on my website. Please help to solve the error ASAP. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.