Considering that you're querying a database for this data, you might want to consider tailoring the query to SELECT only those rows whose fields are NOT NULL, or something along those lines.
The array you then retrieve would then immediately not contain such elements, saving you effort in using PHP to filter out such elements.
Otherwise Thora_Fan's suggestion is a good one, though in more complete form it might be something like:
//callback function to test for non-empty elements.
function nonEmpty($value) {
return trim($value) != "";
}
$array = array_filter($array, "nonEmpty");