8000 Create submit_attendance.php · Abhijeetbyte/SQLite-PHP-Database@f66e41c · GitHub
[go: up one dir, main page]

Skip to content

Commit f66e41c

Browse files
authored
Create submit_attendance.php
1 parent 5ea6573 commit f66e41c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

submit_attendance.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
try {
3+
// Connect to SQLite database
4+
$db = new PDO('sqlite:students.db');
5+
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
6+
7+
// Insert data into Attendance table
8+
$stmt = $db->prepare("INSERT INTO Attendance (roll_no, student_name, date) VALUES (:roll_no, :student_name, :date)");
9+
$stmt->bindParam(':roll_no', $_POST['roll_no']);
10+
$stmt->bindParam(':student_name', $_POST['student_name']);
11+
$stmt->bindParam(':date', date('Y-m-d'));
12+
$stmt->execute();
13+
14+
echo "Attendance recorded successfully.";
15+
} catch (PDOException $e) {
16+
echo "Error: " . $e->getMessage();
17+
}
18+
?>

0 commit comments

Comments
 (0)
0