I don't know if this is a good question or not but it is something that got me into a lot of doubt today. So I was using a PHP function to basically save time and escape values like we used to do with mysql_real_escape()
before but I was told that doing this is actually dangerous, this is what I was doing:
function mysql_string_safe($stringtoclean)
{
$safestring = mysqli_real_escape_string($GLOBALS['confDBLink'],$stringtoclean);
return $safestring;
}
I now have the doubt.. How doing any of this can actually be unsafe? Since all I'm doing is sending a value to the function to then escape it in mysqli_real_escape_string
? (and then returned of course)
So when I actually want to escape a value I would be doing the following:
mysql_string_safe($valuetoescape);
I really wanted to know, not only because of the doubt but to also know, because if this is really dangerous as I was told, then I'll remove this from my applications as well.
Thank you very much for your time.