Re: mysql_real_escape_string paranoid enough?

From: Date: Fri, 20 Mar 2009 16:49:23 +0000
Subject: Re: mysql_real_escape_string paranoid enough?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-290394@lists.php.net to get a copy of this message
On Fri, Mar 20, 2009 at 9:41 AM, Richard Lynch <ceo@l-i-e.com> wrote: > I typically do something like this: > > $data_sql = mysql_real_escape_string($data, $connection); > $query = "insert into data(data) values('$data_sql')"; > $insert = mysql_query($query, $connection); > if (!$insert){ >  trigger_error(mysql_error($connection), E_USER_ERROR); > } Slightly off topic here, but I find it annoying to have to use the connection identifier for the mysqli_real_escape_string. It would be great if there was a function that I could say mysql_escape_string that is using utf-8 instead of default, as opposed to having to use mysqli_real_escape_string. I suppose a custom function could be written using regexps or even simple string replacement and mbstring stuff...

« previous php.general (#290394) next »