<?php 

    include($_SERVER['DOCUMENT_ROOT'] . "/_ps2020/config/connect.php");
    
    $feedid = $_REQUEST["sid"];

		if ($result = $conn->query("DELETE FROM feedback WHERE feedback_id='".$feedid."'") === TRUE) {

			$orderID = $feedid;

			$res_reAllocateID = $conn->query("SELECT * FROM feedback WHERE feedback_id > '$feedid' ");
				if($res_reAllocateID) {
					while ( $row = $res_reAllocateID->fetch_assoc() ){
						// $orderID_new = $orderID + 1;
						$result = $conn->query("UPDATE feedback SET feedback_id = '$orderID' WHERE feedback_id = ".$row['feedback_id']." ");
						$orderID++;
					}
				}
		}

    $conn->close();

?>