<?php
//$student_score = 100;
//$sql = "SELECT * FROM grade WHERE :student_score BETWEEN mark_from AND mark_upto";
//$conn->query($sql);
//$conn->bind(":student_score", $student_score);
//$rowCount = $conn->rowCount();
//
//if($rowCount > 0){
//    $result = $conn->fetchSingle();
//    $grade = $result->grade_name;
//    $note = $result->note;
//
//    echo $grade;
//
//
//
//
//}



?>

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <?php
     include 'includes/styles.php';
     $conn = new Functions();
    ?>
    <title> Test Page |  <?php echo $school_name; ?></title>
</head>
<body style="color: rgb(0,0,0)">

<section class="content">
    <div class="content-fluid">
        <div class="row">
            <section class="col-lg-12 connectedSortable">
                <?php
                $class = 'Year 7';//class ID
                $section = 'Lily';//section ID
                $exam = '3rd term';//exam term
                $exam_year = 2021; //exam year
                $student_name = "Obagho David";

                $sql = "SELECT * FROM students_psychomotor WHERE student_name =:student_name AND section =:section AND 
                        class =:class AND exam =:exam AND exam_year =:exam_year";
                $conn->query($sql);
                $conn->bind(':section', $section);
                $conn->bind(':class', $class);
                $conn->bind(':exam', $exam);
                $conn->bind(':exam_year', $exam_year);
                $conn->bind(':student_name', $student_name);

                $row_count = $conn->rowCount();

                $count = 1;

                ?>
                <div class="card">
                    <div class="card-header">
                        <h3 class="card-title"> Manage Teachers </h3>
                    </div>
                    <!-- /.card-header -->
                    <div class="card-body">
                        <table id="teacher" class="table table-bordered table-striped">
                            <caption style="caption-side: top; text-align: center; text-transform: uppercase; font-weight: bold;">Psychomotor Skills </caption>

                            <thead>
                            <tr>
                                <th>#</th>
                                <th>Name</th>
                                <th>Value</th>
                            </tr>
                            </thead>
                            <tbody>

                            <?php
                             if($row_count > 0){
                                 $result = $conn->fetchMultiple();
                                 foreach ($result as $data){
                                     ?>
                                       <tr>
                                           <td><?= $count; ?></td>
                                           <td><?= $data->psychomotor_name; ?></td>
                                           <td><?= $data->psychomotor_value; ?></td>
                                       </tr>
                                     <?php

                                     $count++;
                                 }
                             }

                            ?>



                            </tbody>
                            <tfoot>
                            <tr>
                                <th>#</th>
                                <th>Name</th>
                                <th>Value</th>
                            </tr>
                            </tfoot>
                        </table>
                    </div>
                    <!-- /.card-body -->
                </div>


            </section>
        </div>
    </div>
</section>

</body>
</html>
