Hi to all
I have this code after execution I am facing this error
public function adminLogin(){
$errorMessage = '';
if(!empty($_POST["login"]) && $_POST["email"]!=''&& $_POST["password"]!='') {
$email = $_POST['email'];
$password = $_POST['password'];
$sqlQuery = "SELECT * FROM ".$this->userTable."
WHERE email='".$email."' AND password='".md5($password)."' AND status = 'active' AND type = 'administrator'";
70 $resultSet = mysqli_query($this->dbConnect, $sqlQuery) or die("error".mysql_error());
71 $isValidLogin = mysqli_num_rows($resultSet);
if($isValidLogin){
$userDetails = mysqli_fetch_assoc($resultSet);
$_SESSION["adminUserid"] = $userDetails['id'];
$_SESSION["admin"] = $userDetails['first_name']." ".$userDetails['last_name'];
header("location: dashboard.php");
} else {
$errorMessage = "Invalid login!";
}
} else if(!empty($_POST["login"])){
$errorMessage = "Enter Both user and password!";
}
return $errorMessage;
}
Fatal error : Uncaught mysqli_sql_exception: No database selected in C:\xampp\htdocs\school-management-system-php-mysql-demo\class\School.php:70 Stack trace: #0 C:\xampp\htdocs\school-management-system-php-mysql-demo\class\School.php(70): mysqli_query(Object(mysqli), ‘SELECT * FROM s…’) #1 C:\xampp\htdocs\school-management-system-php-mysql-demo\index.php(8): School->adminLogin() #2 {main} thrown in C:\xampp\htdocs\school-management-system-php-mysql-demo\class\School.php on line 70