-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeleteLessonbts.php
More file actions
25 lines (20 loc) · 845 Bytes
/
deleteLessonbts.php
File metadata and controls
25 lines (20 loc) · 845 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
include "sql_books_conn.php";
$id = "";
if($_SERVER["REQUEST_METHOD"] == "POST"){
$id = trim($_POST["lessonid"]);
$query = mysqli_query($conn, "SELECT * FROM LESSONS WHERE LID = '$id'");
if(mysqli_num_rows($query)== 1){
$query=mysqli_query($conn, "DELETE FROM LESSONS WHERE LID='$id'");
if($query){
echo '<script> alert("Lesson Deleted Successfully!"); window.location.href = "./deleteLesson.php";</script>';
}
else{
echo '<script> alert("Unsuccessful Deletion!"); window.location.href = "./deleteLesson.php";</script>';
}
}
else{
echo '<script> alert("The Lesson ID '.$id.' does not exist."); window.location.href = "./deleteLesson.php";</script>';
}
}
?>