Quotes in php and mysql

I insert this text into a number of tables on different hosters. And it always works correctly. ie I get the same text back.

<p><img src="/userimages/cherry_1.jpg" alt="" width="400" height="299" /></p>

However today, I had tried with another host and I wind up getting the below code. so my quotes have been changes to \"
Is this due to a parameter in the database ?
If so how can I see this parameter and change it ?


<p><img src="\\&quot;/userimages/cherry_1.jpg\\&quot;" alt="\\&quot;\\&quot;" width="\\&quot;400\\&quot;" height="\\&quot;299\\&quot;" /></p>

Check if magic_quotes is turned on - that is a likely cause of that problem.

OK, I created a .htaccess and added
php_value magic_quotes_gpc 0

and now all works great.

Thank you all for your help


You can find out if magic_quotes are enabled or disabled in the output from phpinfo() search the page for “magic_quotes_gpc”, that line and the two lines below it relate to magic_quotes

magic_quotes is set in your php.ini file.

It should be set to off.

I don’t use htmlentities, only the below code

$n_message = mysql_real_escape_string($message);

then $n_message is what I insert into my database.

Using the same code on X different hosts, I get different results in the database itself.
This might make seeing the problem a bit easier.

This is the host that is giving me the problem, it seems to add its own escape characters in the table’s field .
<img src=\“/userimages/cherry_2.jpg\” alt=\“\” width=\“400\” height=\“299\” /><br />

On 3 other hosts, I get the below.
<img src=“/userimages/cherry_2.jpg” alt=“” width=“400” height=“299” /><br />

Thanks for the input

That is probably the problem.
I have checked in phpMyAdmin and don’t find any referrence to magic quotes.
I have looked in variables

lower case table names 0
max allowed packet 1 048 576
max binlog cache size 4 294 963 200
max binlog size 1 073 741 824
max connect errors

So maybe I am looking in the wrong place.
Where should I look (sorry if this is a dumb question)

It seems your HTML has been converted to html entities and as far as I know, mysql does not convert to entities itself. But the conversion seems little odd if it was converted by PHP function because PHP function does convert mostly other characters too like <, >, etc. But in your case only the double quotes are converted and that again strange thing is after conversion the attribute value has been again enclosed with double quotes again.

Can you paste here your PHP code if you have used PHP function like htmlentities to convert?