$instr = trim($instr); $ins_dir = "$INS_PATH/$instr/"; $file = "$ins_dir$crsid"; $frmText = 0; echo "
"; if (!($fp = fopen($file, "r"))) die("Unable to open the input file."); while (!feof($fp)) { $buffer = fgets($fp, 30000); $csn = substr($crsid,0,4); $firstBlock = "STUDENT TEST RESULTS"; $searchLB = trim(substr($buffer,42,21)); $test1 = strcmp($firstBlock,$searchLB); $questNumb = trim(substr($buffer,3,4)); $ans = trim(substr($buffer,17,4)); $ans1 = trim(substr($buffer,29,4)); $ans2 = trim(substr($buffer,41,4)); $ans3 = trim(substr($buffer,53,4)); $ans4 = trim(substr($buffer,65,4)); $ans5 = trim(substr($buffer,77,4)); if ($test1 == 0) { $frmText = 1; } elseif ($frmText == 1) { if(is_numeric($questNumb) == TRUE) { echo "\"" . $csn . "\"," . $questNumb . "," . $ans . "," . $ans1 . "," . $ans2 . ","; echo $ans3 . "," . $ans4 . "," . $ans5 . "\n"; } else { continue; } } } fclose($fp); echo ""; ?>