<?php

include($_SERVER['DOCUMENT_ROOT'] ."/_ps2020/config/connect.php");

$userid = $_REQUEST["sid"];


    // if ($result = $conn->query("DELETE FROM survey WHERE survey_id='".$sid."'") === TRUE) {

    //     // $result = $conn->query("UPDATE survey SET order_id='".$sOrder."' WHERE order_id>'".$sOrder."'");

    //     $orderID = $sid;

    //     $res_reAllocateID = $conn->query("SELECT * FROM survey WHERE survey_id > '$sid' ");
    //         if($res_reAllocateID) {
    //             while ( $row = $res_reAllocateID->fetch_assoc() ){
    //                 // $orderID_new = $orderID + 1;
    //                 $result = $conn->query("UPDATE survey SET survey_id = '$orderID' WHERE survey_id = ".$row['survey_id']." ");
    //                 $orderID++;
    //             }
    //         }
    // }

    //in case of student delete we just make that user a particpant instead by updating his details in
    //user_account table
    if($result = $conn->query("UPDATE user_account SET accountType = '0', school_id = '0', class_id = '0' WHERE user_id = '" . $userid . "'") === TRUE){
     //   echo "true";
    }

$conn->close();

?>