<?php
require_once './connection.php';

if (!isset($_POST['select_cluster']) == "") {

    $cluster_name = $_POST['select_cluster'];

    $query = 'SELECT * FROM tbl_student where cluster_name="'.$cluster_name.'" ORDER BY id asc';
    echo '$query '.$query;
    mysqli_set_charset($con, 'utf8');
    $result = mysqli_query($con, $query);
//                                                print_r($result);
    if (mysqli_num_rows($result) > 0) {
        $i = 1;
        while ($row = mysqli_fetch_assoc($result)) {
            ?>
            <tr>
                <?php
                if ($row["total_get_mark"] == 20) {
                    ?>
                    <td style="color: green"><b><?php echo $i; ?></b></td>
                    <td style="color: green"><b><?php echo $row["name"]; ?></b></td>              
                    <td style="color: green"><b><?php echo $row["school_name"]; ?></b></td>
                    <td style="color: green"><b><?php echo $row["cluster_name"]; ?></b></td>
                    <td style="color: green"><b><?php echo $row["taluko"]; ?></b></td>
                    <td style="color: green"><b><?php echo $row["district"]; ?></b></td>

                    <td style="color: green"><b><?php echo $row["total_get_mark"]; ?></b></td>
                    <td style="color: green"><b><?php echo $row["grade"]; ?></b></td>
                            <?php
                        } else {
                            ?>
                    <td><?php echo $i; ?></td>
                    <td><?php echo $row["name"]; ?></td>              
                    <td><?php echo $row["school_name"]; ?></td>
                    <td><?php echo $row["cluster_name"]; ?></td>
                    <td><?php echo $row["taluko"]; ?></td>
                    <td><?php echo $row["district"]; ?></td>
                    <td><?php echo $row["total_get_mark"]; ?></td>
                    <td><?php echo $row["grade"]; ?></td>
                    <?php
                }
                ?>


                <td><?php echo $row["quiz_date"]; ?> </td>
            </tr>
            <?php
            $i = $i + 1;
        }
    } else {
        ?>
        <tr>
            <td>0 results</td>
        </tr>
        <?php
    }
} else {
    echo "else ";
}

?>