Re: significance of escape character in string in PHP

From: Date: Mon, 18 Mar 2013 13:11:56 +0000
Subject: Re: significance of escape character in string in PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-320627@lists.php.net to get a copy of this message
On 18.03.2013 09:10, Norah Jones wrote:
I am having an string which was have few ' (single quote) and few " (double quotes) and was not able to insert into the mysql database. I have replaced them with \' and \" and everything is fine. Though this are fine now but don't understand the working and I could have missed few corner cases also. Please suggest the working and also if there is some better way to achieve this.
You should be using either mysql_real_escape_string or mysqli_real_escape_string (preferably the later) depending on how you're accessing the DB. Ken

« previous php.general (#320627) next »