jkubala4454 / Auto-Classroom-Attendance

A web app to automatically take attendance by scanning an ID card, RFID tag, or QR code as students enter the classroom.
GNU General Public License v3.0
2 stars 1 forks source link

Student Sign In error on Weekends #3

Closed jkubala4454 closed 5 days ago

jkubala4454 commented 5 days ago

When a student tries to login on the weekend, the following error message is displayed:

// functions.php function getCurrentDayType() { include('db.php'); // Include the database connection // Get the current date $current_date = date("Y-m-d"); // Prepare the SQL query to get the day type for the current date $query = "SELECT day_type FROM school_calendar WHERE date = ?"; $stmt = $conn->prepare($query); if (!$stmt) { die("Query preparation failed: " . $conn->error); } $stmt->bind_param("s", $current_date); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows > 0) { // Fetch the day type if a matching date is found $row = $result->fetch_assoc(); return $row['day_type']; // Return the day type (e.g., 'A Day', 'B Day', 'Weekend', 'Holiday') } else { return "Unknown"; // Handle case when the current date is not found in the calendar } $stmt->close(); }

jkubala4454 commented 5 days ago

Problem was with functions.php