I'm getting this PHP warning: Warning: log() expects parameter 1 to be float, string given in (route to this file)
I don't know why... I'm not declaring the type of the variable. Any help?
Here's the code:
    function sanitizeMysql ($string, $mysqli) {
        return $mysqli->real_escape_string($string);
    }
    function sanitizeHtml ($string) {
        return htmlspecialchars($string);
    }
    function log ($data, $mysqli) {
        $data = sanitizeMysql($data, $mysqli);
        $data = sanitizeHtml($data);
        if ($insert = $mysqli->prepare("INSERT INTO log (data) VALUES ('" . $data . "')")) {
            if ($insert->execute()) {
                return $mysqli->insert_id;
            } else {
                return $mysqli->error;
            }
        }  else {
            return $mysqli->error;
        }
    }
$url = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$error = "Unauthorized view of ". $url;
log($error, $mysqli);
exit();
$mysqli is declared and working. Any idea?
 
     
     
    