prepare("select * from marks where (acad_session = '$yr' and term = '$trm') and stclass = '$cls' ") ; $sql->execute() ; $num_rows =$sql->rowcount() ; } if (array_key_exists('deletebt', $_POST)) { if(isset($_SESSION["clas"] )) { $c = $_SESSION["clas"] ; $t = $_SESSION["tm"] ; $y = $_SESSION["yrs"] ; $del = $DBcon->prepare("delete from marks where (stclass = '$c' and term = '$t') and acad_session = '$y' ") ; if($del->execute()) $msg = 'Records Deleted Succesfully' ; else $msg = 'Some thing went wrong, Records was not deleted' ; // $_SESSION = array(); //session_destroy(); } else $ms = 'Please Select Result Data and Display the Result first then Click Delete Button after that.' ; } ?>