public static function checkValidResult($result, $function)
{
if (!$result instanceof \mysqli_result) {
if ($function != "mysql_fetch_object") {
trigger_error($function . "() expects parameter 1 to be resource, " . strtolower(gettype($result)) . " given", E_USER_WARNING);
}
if ($function == "mysql_fetch_object") {
trigger_error($function . "(): supplied argument is not a valid MySQL result resource", E_USER_WARNING);
}
return false;
}
}