note 36233 added to function.addslashes

From: Date: Wed, 01 Oct 2003 23:09:30 +0000
Subject: note 36233 added to function.addslashes
Groups: php.notes 
Request: Send a blank email to php-notes+get-57564@lists.php.net to get a copy of this message
Here's what I've used on my strings before entering them into the database because personaly I find this works best. In this example the variable is $quote. // Checks quote. if (!empty($quote)) { $quote = str_replace("'","’",$quote); $quote = str_replace('"',""",$quote); } Of course you don't need the if (!empty($quote)) but I like to use it because if it's empty it's not gonna contain ' or ". This way it'll look the exact same accept it'll be accepted into the database no problem and can be moved around no problem. Since ' and " could end strings but ’ and " will not. ’ will show up as a "right single quote" and " will show up as a double quote. ---- Manual Page -- http://www.php.net/manual/en/function.addslashes.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+36233 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+36233&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+36233&report=yes

« previous php.notes (#57564) next »