What is causing the error message related to the MySQL result resource in the getGroupData function?

The error message related to the MySQL result resource in the getGroupData function is likely caused by not properly fetching the data from the result set or not handling the result resource correctly. To solve this issue, make sure to fetch the data from the result set using functions like mysqli_fetch_assoc() and free the result resource after using it to avoid memory leaks.

// Correct implementation of getGroupData function
function getGroupData($group_id) {
    $conn = mysqli_connect("localhost", "username", "password", "database");

    $query = "SELECT * FROM groups WHERE group_id = $group_id";
    $result = mysqli_query($conn, $query);

    $group_data = mysqli_fetch_assoc($result);

    mysqli_free_result($result);
    mysqli_close($conn);

    return $group_data;
}