Search code examples
phpmysqlmysqlimysql-real-escape-string

mysqli_real_escape_string() expects parameter 1 to be mysqli, null given in


.../general.php on line 10

Hello, this is my error, but only occurs when I upload my web to a host, in the localhost run well.

the (return mysqli_real_esc..)line is the "line 10".

$conncet = mysqli_connect('xxx','xxx','xxx','xxx');
function array_sanitize(&$datos) {
		global $connect;
		$datos = mysqli_real_escape_string($connect,$datos);
}

thanks for your time!!


Solution

  • i think you have typo in your variable, please check your $connect => $conncet variable

    $conncet = mysqli_connect('xxx','xxx','xxx','xxx');
    function array_sanitize(&$datos) {
    		global $connect;
    		$datos = mysqli_real_escape_string($connect,$datos);
    }