Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Apostrophes in category & products name


Salvo

Recommended Posts

Posted

Hi all,

 

I have just noticed that using user_tracking or maybe it is something else,

when a cateogry or product includes apostrophes

ie. St. Paul's, it give me an error

 

1064 - Erreur de syntaxe pr?s de 's')' ? la ligne 1

insert into user_tracking (customer_id, full

 

is there way to about it without compromising the use of ( ' ) in the world?

 

I have many Italian words with the apostophe, I wouldn't like to change them all.

 

Thanks

 

Salvo

Posted

when ' apostrophes are used mysql interprets these as code so you need to place \ before a '

as in St. Paul\'s,

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Posted

Yes, I know that, the only problem is that the apostrophes is in the category name and If I try to put St. Paul\'s, it delete the \ and I don't know why. Try it..

 

The error occurs because I am using the user trucking contribution, that insert the category name into the table with the apostrophe.

 

is there a way around it?

 

Thanks

 

Salvo

Posted

try this code in place of an apostrophe here I have to seperate the code eliments or you will just see '


followed by

39;

take the first part of the code and place it together with the second part of the code so that you have no spaces this number code gives an apostrophe

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Posted

Hi,

 

This comes from your magic_quote setting in php.ini or .htaccess.

I dont think OSC does the right check for this like HERE in the example.

 

Try adding this to your .htaccess

 

<IfModule mod_php4.c>

php_flag magic_quotes_gpc On

</IfModule>

Posted
Hi,

 

This comes from your magic_quote setting in php.ini or .htaccess.

I dont think OSC does the right check for this like HERE in the example.

 

Try adding this to your .htaccess

 

<IfModule mod_php4.c>

php_flag magic_quotes_gpc On

</IfModule>

This didn't work

 

here where the error is

 

1064 - Erreur de syntaxe pr?s de 's Cathedral')' ? la ligne 1

 

insert into user_tracking (customer_id, full_name, session_id, ip_address, time_entry, time_last_click, last_page_url, page_desc) values ('', 'Guest', '09a3e1d134fa73f0fc5830f1bd34c498', 'ip', '1076996753', '1076996753', '/site2004/product_info.php?cPath=1_17&products_id=180&osCsid=09a3e1d134fa73f0fc5830f1bd34c498', 'St. Paul's Cathedral')

 

 

Any other help is appreciated

 

Salvo

Posted

ok I thought you ment when you create a category you get that error.

 

Try this

user_tracking.php line 52

 

$page_desc = $page_desc_values['categories_name'];

 

 

$page_desc = addslashes($page_desc_values['categories_name']);

Posted

I have changed like this and still don't work

should I change them all? how do you change the master?

 

magic_quotes_gpc On Off

magic_quotes_runtime Off Off

magic_quotes_sybase Off Off

 

this is this in the php.ini

 

; - magic_quotes_gpc = Off [Performance]

; Input data is no longer escaped with slashes so that it can be sent into

; SQL databases without further manipulation. Instead, you should use the

; function addslashes() on each input element you wish to send to a database.

 

How and where do you add the function addslashes() ?

Posted

Your problem was only with this mod.

 

Edit this file

catalog/includes/functions/user_tracking.php line 52

 

Change this

$page_desc = $page_desc_values['categories_name'];

 

To this

$page_desc = addslashes($page_desc_values['categories_name']);

Posted

Dave,

 

I will try your advice tonight (GMT TIME) and I will let you know.

 

Thanks

 

Salvo

Posted
Your problem was only with this mod.

 

Edit this file

catalog/includes/functions/user_tracking.php line 52

 

Change this

$page_desc = $page_desc_values['categories_name'];

 

To this

$page_desc = addslashes($page_desc_values['categories_name']);

Well Done Dave

 

I have added addslashes and it worked very well

 

Thank you

 

Salvo

Archived

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

×
×
  • Create New...