This is the function that I am currently using (from the php book I bought):
function escape($data) {
return mysql_real_escape_string(trim($data), $this->linkid);
}
But I feel it could be safer. for example, you can use htmlspecialchars. It always makes me paranoid. I read that mysql_real_escape_string is bad and never use it, but then I also read it in the best way. There is a lot of confusion regarding data deactivation when inserting them into the database.
So how do you do this? and what are the pros and cons of how you do it.
source
share