mysqli::query() expects parameter 1 to be string
===

i am getting this error and can not for the life of me figure out why the error is:

Warning: mysqli::query() expects parameter 1 to be string, object given in ... on line 34

which causes

Fatal error: Call to a member function fetch_array() on a non-object in ... on line 36

and here is my code

    $products = $mysqli->real_escape_string($_GET['products']);
    $query_cat = 'SELECT DISTINCT `Category` FROM `products` where `Type`="'. $products. '"'; //for cotegories
    $cat_id = cat($query_cat);

this produces a string SELECT DISTINCT `Category` FROM `products` where `Type`="bakery" (confirmed by echo)
and here is the function in question

    function cat($query_cat){
        global $mysqli;
        $result = $mysqli->query($query_cat); //line 34
        $i='0';
        while ($row = $result->fetch_array(MYSQLI_ASSOC)){
            $i++;
            $id[$i] = $row["Category"];
        }
        $result->close();
        return $id;
    }

yet this works

    function cat($query_cat){
        global $mysqli; //echo $query_cat here will give correct query
        $products = $mysqli->real_escape_string($_GET['products']);
        $query_cat = 'SELECT DISTINCT `Category` FROM `products` where `Type`="'. $products. '"'; //for cotegories
        $result = $mysqli->query($query_cat);
        $i='1';
        while ($row = $result->fetch_array(MYSQLI_ASSOC)){
            $id[$i] = $row["Category"];
            $i++;
        }
        $result->close();
        return $id;
    }