prepare("select * from subjects where subjectname = '$tsubj' ") ; $gts->execute() ; $srow = $gts->fetch(pdo::FETCH_ASSOC) ; $sbno = $srow['subject_id'] ; if (array_key_exists('submit', $_POST)) { $acyear = $_SESSION['schsession'] ; $schterm = $_SESSION['scterm'] ; $classid =$_SESSION['upclass']; //check if File has been selet if ($_FILES["file"]["error"] > 0) { $ret = 'You did not Select the result Datafile, Browse and Select it before clicking Upload Button' ; //echo "Error: " . $_FILES["images"]["error"] ; } else { //define variables $subj = trim($_POST['subject']); // mysql_select_db("$database", $conn); $res = $DBcon->prepare("SELECT subject_id , subjectname FROM subjects where subjectname = '$subj' "); $res->execute() ; $row1 = $res->FETCH(PDO::FETCH_ASSOC) ; $resultid = $row1['subject_id'] ; //chk if the result has been uploaded before $chksql = $DBcon->prepare("select * from marks where (subject_id = ' $resultid' and stclass = '$classid') and (term = '$schterm' and acad_session = '$acyear' )") ; $chksql->execute() ; //$crow = mysql_fetch_array($rac); if($chksql->rowcount() > 0) $dupl = "$subj - has been Uploaded Before, Select another Subject " ; //end check else { $file = $_FILES['file']['tmp_name']; $handle = fopen($file, "r"); $c = 0; while(($filesop = fgetcsv($handle, 1000, ",")) !== false) { $regno = $filesop[0]; $first = $filesop[1]; $mid = $filesop[2]; $exam = $filesop[3]; $sql = $DBcon->prepare("insert into marks (stregno ,acad_session,term,subject_id,stclass,test,midterm,exam) values ('$regno' , '$acyear','$schterm', '$resultid', '$classid', '$first','$mid','$exam')"); if($sql->execute()) $ok = 'yes' ; else $ok = 'no'; $c = $c + 1; } if($ok = 'yes'){ //echo "You database has imported successfully. You have inserted ". $c ." recoreds"; $message[] = " $subj - Uploaded Succesfully ". $c ." recoreds"; }else{ $message [] = "Sorry! There is some problem."; } } } } ?> Uploading Results

Uploading Academic Result .........


Uploading

'; foreach ($message as $item) { echo "
  • $item
  • "; } echo ''; } ?>
    Instructions:
    1.Please Browse to Select the File you are Uploading and Select the Subject from the Combo Box before Clicking Upload Button
    2. Remeber to Click Change Class Button above to Change the Class and Data when you finish with one class

    Select Subjects

    BROWSE TO SELECT RESULT FILE


    For More Help ? Contact UsClick Here.