-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdateLessonbts.php
More file actions
39 lines (34 loc) · 1.21 KB
/
updateLessonbts.php
File metadata and controls
39 lines (34 loc) · 1.21 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
include "sql_lesson_conn.php";
$id = $fno = "";
if($_SERVER["REQUEST_METHOD"] == "POST"){
$id = trim($_POST["lessonid"]);
$lname = trim($_POST["lname"]);
$link = trim($_POST["link"]);
$query = mysqli_query($conn, "SELECT * FROM LESSONS WHERE LID = '$id'");
if(mysqli_num_rows($query) == 1){
if($lname!=''){
$query=mysqli_query($conn, "UPDATE LESSONS SET LNAME='$lname' WHERE LID='$id'");
if($query){
;
}
else{
echo '<script> alert("Unsuccessful Update!"); window.location.href = "./updateLesson.php";</script>';
}
}
else if($link!=''){
$query=mysqli_query($conn, "UPDATE LESSONS SET LINK='$link' WHERE LID='$id'");
if($query){
;
}
else{
echo '<script> alert("Unsuccessful Update!"); window.location.href = "./updateLesson.php";</script>';
}
}
echo '<script> alert("Lesson Updated Successfully!!"); window.location.href = "./updateLesson.php";</script>';
}
else{
echo '<script> alert("The ID '.$id.' does not exist. Enter a different Lesson ID."); window.location.href = "./updateLesson.php";</script>';
}
}
?>