<?php
    include "../backend/connection.php";
    $configure = new DefaultDatabase();
    $conf = $configure->connect();

    //pupil registration
    if(isset($_POST["register_results"]))
    {

        $participant = htmlspecialchars($_POST["participant"]);
        $points = htmlspecialchars($_POST["points"]);

        //fetch pupil details
        $details = mysqli_query($conf,"SELECT * FROM participants WHERE id = '".$participant."'");
        $det = mysqli_fetch_array($details);

        $current_status = $det["status"] + 1;
        $current_points = $det["points"] + $points;

        $register = mysqli_query($conf,"UPDATE participants SET status = '".$current_status."', points = '".$current_points."' WHERE id = '".$participant."'");
        
    }

?>