Jump to content

Too many slashes


Canman2005

Recommended Posts

Hi all

 

I am using

 

mysql_real_escape_string

 

when posting any data from a form to a QUERY, but I am getting an increasing number of slashes appearing, sometimes as many as 7 or 8 of them per value.

 

I am using strip the php strip slashes funtion to remove them, but it does seem to be leaving some values with slashes in them

 

How can I strip all slashes?

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/134753-too-many-slashes/
Share on other sites

function clean($str)
{
        $str = (get_magic_quotes_gpc()) ? stripslashes($str) : $str;
        return mysql_real_escape_string($str);
}

$var = clean($_POST['var']);

$sql = "INSERT INTO mytable (myvar) VALUES ('$var')";

 

Link to comment
https://forums.phpfreaks.com/topic/134753-too-many-slashes/#findComment-701899
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.