What alternative method, besides using is_array, can be used to handle cases where mysql_fetch_array returns NULL?

When mysql_fetch_array returns NULL, it means that there are no more rows to fetch from the result set. To handle this situation, you can use the mysqli_num_rows function to check if there are any rows returned before attempting to fetch them. This way, you can avoid errors related to trying to fetch from an empty result set.

$result = mysqli_query($connection, $query);

if(mysqli_num_rows($result) > 0){
    while($row = mysqli_fetch_array($result)){
        // Process the fetched data
    }
} else {
    echo "No rows returned.";
}