foreach ($majors as $major) { echo '<h4>' . $major->name . '</h4>'; $sectors = $t->getSectorTypes($major->icao); if ($sectors) { foreach ($sectors as $sector => $call) { $students = array(); $not = array(); $check = array(); $vals = $t->getValidatedSector($major->icao, $sector); //get list of validations by sector // echo '<pre>'; // print_r($vals); // echo '</pre>'; if ($vals) { foreach ($vals as $val) { if ($t->maxValidatedSectorType($major->icao, $val->cid)->position_type_id == $val->position_type_id) { //Makes sure the sector type is the highest for this cid and icao $not[] = $val->cid; if (!in_array($val->cid, $students)) { $students[] = $val->cid; } //if!inarray } //if$t } //vals loop 34 if (count($not) && count($students)) { echo '<div class="panel panel-warning"> <div class="panel-heading"> <h3 class="panel-title">' . $major->icao . '_' . $call; if ($call !== "DEL") {