There seems to be a lot of information about this issue all over the internet with no real clarity on required steps.
I am trying to create a 'catch-all' function to prepare strings prior to storage to DB.
function sanitiseThis($string) {
$string = trim($string);
$string = htmlentities($string);
$string = mysqli_real_escape_string($string);
return $string;
}
is the trim()/htmlentities() necessary?