note 36233 deleted from function.addslashes by didou

From: Date: Thu, 02 Oct 2003 09:04:31 +0000
Subject: note 36233 deleted from function.addslashes by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-57596@lists.php.net to get a copy of this message
Note Submitter: spike at spikesolutions dot com ---- 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.

« previous php.notes (#57596) next »