Page 1 of 1

Parsing ' 's

Posted: Wed Jan 14, 2004 6:26 pm
by Straterra
I have a datebase, but when I try to enter things into it with ' 's in it, it returns a '' instead of '. I wrote this simple function to try to fix it, but it doesn't seem to work!

Code: Select all

function fromsafe($var1) {
$var2 = "''";
$var3 = "'";
return(ereg_replace($var2, $var3, $var1));
}

The ' 's still have a \ infront of them. Help!

Posted: Wed Jan 14, 2004 6:33 pm
by Gen-ik
$var1 = stripslashes($var1);

Check out [php_man]stripslashes[/php_man] for more info.

Posted: Wed Jan 14, 2004 11:25 pm
by McGruff