try this
return mysqli_real_escape_string ($conection,$string);
mysqli_real_escape_string need two parameter,
$connection
variable is the variale which you uses to connect with the database, you might have to change this with your original variable
and check this link as well try http://php.net/manual/en/function.mysql-real-escape-string.php