Error with placing quotes on the screen

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
anonymous2007
Forum Newbie
Posts: 3
Joined: Mon Apr 30, 2007 1:01 pm

Error with placing quotes on the screen

Post by anonymous2007 »

Does anybody here know the solution to the following problem?
By means of a php script I retrieve data from a mysql database and then place the data on the screen. However sometimes the ' and " are placed incorrectly on the screen as \' and \" and other times these characters are placed on the screen correctly as a ' en ". So when I reload the page from the webserver via internet in the browser this sometimes goes correctly and other times goes incorrectly. When I execute the same script locally on my own computer the above mentioned error does not occur. The webserver uses mysql 5.0.27 en php 4.0.6. Locally on my own computer I use php 4.0.5, mysql 3.23.32 and apache 1.3.14.
I've also tried the stripslashes() function but with no success.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Re: Error with placing quotes on the screen

Post by volka »

anonymous2007 wrote:So when I reload the page from the webserver via internet in the browser this sometimes goes correctly and other times goes incorrectly.
That's the spooky part. Please try

Code: Select all

foreach(array('magic_quotes_gpc','magic_quotes_runtime','magic_quotes_sybase') as $p) {
	echo 'debug: ', $p, '=', ini_get($p) ? 'on':'off', "<br />\n";
}
anyway.
anonymous2007
Forum Newbie
Posts: 3
Joined: Mon Apr 30, 2007 1:01 pm

Post by anonymous2007 »

This is the result:

debug: magic_quotes_gpc=on
debug: magic_quotes_runtime=off
debug: magic_quotes_sybase=off
anonymous2007
Forum Newbie
Posts: 3
Joined: Mon Apr 30, 2007 1:01 pm

Post by anonymous2007 »

This seems to solve the problem:

set_magic_quotes_runtime(0);
Post Reply