1
下面是代碼數據我上傳的原始文件後,然後試圖驗證的原始文件,上傳文件,看它們是否匹配:比較上傳數據庫,並把原始CSV數據
while ($db_fetch_row = sqlsrv_fetch_array($database_query)){
$db_eid = $db_fetch_row['eid'];
$db_team_lead = $db_fetch_row['team_lead'];
$db_role = $db_fetch_row['role'];
$db_productivity = $db_fetch_row['productivity'];
$db_quality = $db_fetch_row['quality'];
$db_assessment = $db_fetch_row['assessment'];
$db_staffed_hours = $db_fetch_row['staffed_hours'];
$db_kpi_productivity = $db_fetch_row['kpi_productivity'];
$db_kpi_quality = $db_fetch_row['kpi_quality'];
$db_kpi_assessment = $db_fetch_row['kpi_assessment'];
$db_kpi_staffed_hours = $db_fetch_row['kpi_staffed_hours'];
for($row = 2; $row <= $lastRow; $row++) {
$eid = $worksheet->getCell('A'.$row)->getValue();
$team_lead = $worksheet->getCell('C'.$row)->getValue();
$role = $worksheet->getCell('B'.$row)->getValue();
$productivity = $worksheet->getCell('D'.$row)->getValue();
$productivity1 = chop($productivity,"%");
$quality = $worksheet->getCell('E'.$row)->getValue();
$quality1 = chop($quality,"%");
$assessment = $worksheet->getCell('F'.$row)->getValue();
$assessment1 = chop($assessment,"%");
$staffed_hours = $worksheet->getCell('G'.$row)->getValue();
$staffed_hours1 = chop($staffed_hours,"%");
$kpi_productivity = $worksheet->getCell('H'.$row)->getValue();
$kpi_quality = $worksheet->getCell('I'.$row)->getValue();
$kpi_assessment = $worksheet->getCell('J'.$row)->getValue();
$kpi_staffed_hours = $worksheet->getCell('K'.$row)->getValue();
if($db_eid == $eid) {
echo "Raw and Uploaded file Matched";
} else {
echo "Did not match";
}
}
}
輸出始終沒「T匹配,你可以看到如下:
那麼它不是_always_「不匹配」,看起來像你的第一行匹配了。 – roberto06