note 11223 deleted from str_replace by jmcastagnetto

From: Date: Sun, 11 Feb 2001 06:29:11 +0000
Subject: note 11223 deleted from str_replace by jmcastagnetto
Groups: php.notes 
Request: Send a blank email to php-notes+get-10899@lists.php.net to get a copy of this message
It inserts a backslash for you - weird sideeffect if you are doing mysql inserts - stuffs up inserts if you use: $fieldname = "18' doughboy pool"; str_replace ("'", "''", $fieldname); /* two ' marks */ -> $fieldname = "18'' doughboy pool"; which breaks INSERT in mysql Here is what works: $fieldname = "18' doughboy pool"; str_replace("'", "'", $fieldname); /* one ' mark */ -> $fieldname = "18' doughboy pool";

« previous php.notes (#10899) next »