Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

1064 Sql error in Short Description in Products mod


rdranoel

Recommended Posts

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

Link to comment
Share on other sites

$listing['products_id'] is blank.

 

It is not the sql.

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

$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

Link to comment
Share on other sites

  • 4 years later...

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...