I normally use the below function to sanitize my form inputs and get values. But this is suddenly stopped working and understand that get_magic_quotes_gpc() feature has been removed from PHP since version 5.4. and cannot enable or configure it anymore, it is permanently set to "off". Right now i'm using PHP 5.6, can somebody suggest me a function like this to sanitise data and prevents SQL injection.
function clean($str) {
$str = @trim($str);
if(get_magic_quotes_gpc()) {
$str = stripslashes($str);
}
return mysql_real_escape_string($str);
}