Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

apostraphe casuing error in product name for search queries


ridesign

Recommended Posts

Hi,

I have a contribution which logs search queries however when any product with a aphostrahe " ' " is searched it returns 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 'aim

')' a

 

insert into search_queries (search_text,search_result) values ('a','(pid 119) L'aim')

 

[TEP STOP]

 

Is there a way to resolve this?

 

thanks

+ merry christmas to everyone

Link to comment
Share on other sites

I have a contribution which logs search queries however when any product with a aphostrahe " ' " is searched it returns the following error:
Probably, this contribution does not use the osC way of doing an insert (using function tep_db_perform in includes/functions/database.php) and therefore it doesn't put a backslash in front of the apostrophe, therefore MySQL sees it as the end of the string and when it sees the next apostrophe: error.

The function tep_db_perform adds slashes in this line:

	  default:
		$query .= '\'' . tep_db_input($value) . '\', ';

where tep_db_input does the addslashes (a PHP function):

  function tep_db_input($string) {
return addslashes($string);
 }

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...