Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • HTML/FPDF Table

    • 0
    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 1.02k
    Answer it

    I am trying to print this sample report in pdf

    so far this is what I have

    1st Problem: the report should have another 2 cell (Ave and %) below the criteria which are (Exam, Progress Report, Quiz, Project)

    2nd Problem: The records under the criteria, grade and remark are the same but in my database, the are not the same.

    this is my code so far:
     

    $sql_criteria = mysql_query("SELECT DISTINCT criteria, percentage  FROM tb_equivalent WHERE instructor_id = '$inst_id' AND description = '$desc' AND subj_code = '$code' AND term = '$term'");
    	$criteria = array();
    	while($row = mysql_fetch_assoc($sql_criteria)){
    		$criteria[] = $row['criteria'];
    		$pdf->SetFont('Arial','',9);
    		$pdf->Cell(35,5,$row['criteria'],1,'','C');
    		//$pdf->Cell(17.5,5,'Ave',1,'','C');
    		//$pdf->Cell(17.5,5,$row['percentage']."%",1,'','C');
    	}
    	$pdf->Cell(35,10,'Grade',1,0,'C');
    	$pdf->Cell(35,10,'Remark',1,0,'C');
    	$pdf->SetFont('Arial','',9);
    	$pdf->Ln();
    	$sql = mysql_query("SELECT * FROM tb_equivalent INNER JOIN tb_student ON   tb_equivalent.stud_id=tb_student.stud_id WHERE tb_equivalent.instructor_id = '$inst_id' AND tb_equivalent.description = '$desc' AND tb_equivalent.subj_code = '$code' GROUP BY tb_equivalent.stud_name ORDER BY stud_lname ASC");
    	while($row = mysql_fetch_array($sql)){
    		$name = $row['stud_name'];
    		$course = $row['course_and_year'];
    		$pdf->SetFont('Arial','',9);
    		$pdf->Cell(1);
    		$pdf->Cell(40,4,$name,1);
    		$pdf->Cell(20,4,$course,1,0,'C');
    
    		for($x = 0; $x < count($criteria); $x++){
    			$query_rec = mysql_query("SELECT * FROM tb_equivalent INNER JOIN tb_student ON tb_equivalent.stud_id=tb_student.stud_id WHERE tb_equivalent.instructor_id = '$inst_id' AND tb_equivalent.criteria = '".$criteria[$x]."' AND tb_equivalent.description = '$desc' AND tb_equivalent.subj_code = '$code' AND tb_equivalent.term = '$term' ORDER BY stud_lname ASC");
    			$record = mysql_fetch_array($query_rec);
    			$pdf->Cell(17.5,4,$record['average'],1,0,'C');
    			$pdf->Cell(17.5,4,$record['equivalent'],1,0,'C');
    			
    		}
    		$query_grade = mysql_query("SELECT grade, remark FROM tb_record_grade WHERE instructor_id = '$inst_id' AND description = '$desc' AND subj_code = '$code' AND term = '$term'");
    		$row_grade = mysql_fetch_array($query_grade);
    		$pdf->Cell(35,4,$row_grade['grade'],1,0,'C');
    		$pdf->Cell(35,4,$row_grade['remark'],1,0,'C');
    		$pdf->Ln();
    	}

     

     

     

     

     

 1 Answer(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: