function getDepartmentIds($userId, $dbConn) { $sqlQuery = "SELECT department_id FROM users JOIN departments ON users.department_id = departments.id WHERE users.id = $userId"; $result = mysqli_query($dbConn, $sqlQuery); $deptIds = []; while ($row = mysqli_fetch_assoc($result)) { array_push($deptIds, $row['department_id']); } return $deptIds; }In this example, we have defined a function getDepartmentIds that takes two parameters: the user ID and a database connection. The function queries the database to get department IDs associated with the user and returns them as an array. Package/Library: The above code example is using the MySQLi library to establish a database connection, query the database and fetch the results. However, it is not clear what package, library, or framework is being used to build the overall application. It could be native PHP or any PHP frameworks like Laravel, Codeigniter, Symfony, etc.