如何检查MySQL结果以确定结果中的字段是否为空

I have some fairly complex MySQL queries that return about 30 fields. I am doing some conditional formatting for a report and need to determine if any of those fields are empty across all of the results. I know how to check on a per row basis, but I need to determine if an entire "column" is empty after returning the results.

I'm using PHP 5.2 and simple HTML to generate the reports.

Something like this?

$results = mysql_fetch_array($resource);

$columnEmpty = checkEmptyColumn($results, "column_name"); // returns true if empty

function checkEmptyColumn($array, $columnName){
    foreach ($array as $arr){
        if(!empty($arr[$columnName])) return false;
    }

    return true;
}