What function should be used to fetch the result of a MySQL query in PHP?

To fetch the result of a MySQL query in PHP, you should use the `mysqli_fetch_assoc()` function. This function fetches a result row as an associative array. You can then access the data from the query result using the keys of the associative array.

// Assuming $conn is your MySQL database connection and $query is your SQL query
$result = mysqli_query($conn, $query);

if ($result) {
    while ($row = mysqli_fetch_assoc($result)) {
        // Access data from the query result using $row['column_name']
        echo $row['column_name'];
    }
} else {
    echo "Error: " . mysqli_error($conn);
}