Inspekt\Inspekt::escMySQL PHP Method

escMySQL() public static method

Escapes the value given with mysql_real_escape_string
public static escMySQL ( string $value, resource $conn ) : mixed
$value string
$conn resource the mysql connection. If none is given, it will use the last link opened, per behavior of mysql_real_escape_string
return mixed
    public static function escMySQL($value, $conn)
    {
        if (Inspekt::isArrayOrArrayObject($value)) {
            return Inspekt::walkArray($value, 'escMySQL');
        } else {
            //no explicit func to check if the connection is live, but if it's not $conn would be false
            if (is_resource($conn)) {
                return mysqli_real_escape_string($conn, $value);
            } else {
                throw new UnexpectedValueException("Connection passed is not a valid resource");
            }
        }
    }