public function callData() { parent::conn(); if (isset($this->LoginId) && $this->LoginPassword) { $sql = "SELECT * FROM admin WHERE ID=('{$this->LoginId}')&& PASSWORD=('{$this->LoginPassword}')"; $result = mysqli_query($this->con, $sql); if ($result === FALSE) { echo "error in query"; die(mysql_error()); // TODO: better error handling } while ($row = mysqli_fetch_array($result)) { $this->Logid = $row['ID']; $this->Logpwd = $row['PASSWORD']; echo $this->Logid . "<br>"; } if ($this->LoginId == $this->Logid && $this->LoginPassword == $this->Logpwd) { header("Location:Admin_module.html"); } else { echo " Please Enter Valid ID and Password <br> " . "<a href=A_login.html>Click here </a>" . " to Login Again"; } } else { echo " Please Enter Valid ID and Password <br> " . "<a href=A_login.html>Click here </a>" . " to Login Again"; } }
public function addData() { parent::conn(); if ($this->CourseID && $this->CourseName != null) { $sql = "INSERT into courses (COURSE_ID,COURSE_NAME)\n\t\t\tVALUES('{$this->CourseID}','{$this->CourseName}')"; if (mysqli_query($this->con, $sql)) { header("Location:addcourse.php"); } else { echo "Error: " . $sql . "<br>" . mysqli_error($this->con); } } }
function f_DeleteCourse() { parent::conn(); foreach ($_POST['Course'] as $Courses) { $sql = "DELETE FROM courses WHERE COURSE_ID=('{$Courses}')"; if ($result = mysqli_query($this->con, $sql)) { header("Location:DeleteCourse.php"); } else { echo "Error In Query"; } } }