$mismatchRows = "";
 foreach ($devList as $devRow) {
     if ($devRow->Cabinet != $lastCabinet) {
         $cab->CabinetID = $devRow->Cabinet;
         $cab->GetCabinet();
         $lastCabinet = $cab->CabinetID;
         $cabinet = $cab->Location;
     }
     if ($cab->DataCenterID != $lastDC) {
         $dc->DataCenterID = $cab->DataCenterID;
         $dc->GetDataCenter();
         $lastDC = $dc->DataCenterID;
         $dataCenter = $dc->Name;
     }
     $port->DeviceID = $devRow->DeviceID;
     $activeCount = intval($port->getActivePortCount());
     $portList = $port->getPorts();
     $statusList = SwitchInfo::getPortStatus($devRow->DeviceID);
     if (sizeof($statusList) == sizeof($portList) && sizeof($portList) > 0) {
         for ($n = 0; $n <= sizeof($portList); $n++) {
             // The return from getPorts() is not a sequential array, it's associative, so you can't iterate through by number
             $currPort = array_shift($portList);
             if ($statusList[$n + 1] == "up" && ($currPort->Notes == "" && $currPort->ConnectedDeviceID == null) || $statusList[$n + 1] == "down" && ($currPort->Notes != "" || $currPort->ConnectedDeviceID != null)) {
                 if ($currPort->ConnectedDeviceID > 0) {
                     $dev->DeviceID = $currPort->ConnectedDeviceID;
                     $dev->GetDevice();
                     $devAnchor = "<a href=\"" . $urlBase . "devices.php?DeviceID=" . $dev->DeviceID . "\">" . $dev->Label . "</a>";
                     $port->DeviceID = $currPort->ConnectedDeviceID;
                     $port->PortNumber = $currPort->ConnectedPort;
                     $port->getPort();
                     $portName = $port->Label;