connect_error) { die("Connection failed: " . $conn->connect_error); } // Insert new student if (isset($_POST['insert'])) { $name = $conn->real_escape_string($_POST['name']); $math = (int)$_POST['math']; $science = (int)$_POST['science']; $english = (int)$_POST['english']; $sql = "INSERT INTO students (name, math, science, english) VALUES ('$name', $math, $science, $english)"; $conn->query($sql); header("Location: " . $_SERVER['PHP_SELF']); exit; } // Delete student if (isset($_GET['delete'])) { $id = (int)$_GET['delete']; $conn->query("DELETE FROM students WHERE id=$id"); header("Location: " . $_SERVER['PHP_SELF']); exit; } // Update student if (isset($_POST['update'])) { $id = (int)$_POST['id']; $name = $conn->real_escape_string($_POST['name']); $math = (int)$_POST['math']; $science = (int)$_POST['science']; $english = (int)$_POST['english']; $sql = "UPDATE students SET name='$name', math=$math, science=$science, english=$english WHERE id=$id"; $conn->query($sql); header("Location: " . $_SERVER['PHP_SELF']); exit; } // Fetch all students $result = $conn->query("SELECT * FROM students ORDER BY id ASC"); // If editing, fetch the record $edit_record = null; if (isset($_GET['edit'])) { $id = (int)$_GET['edit']; $res = $conn->query("SELECT * FROM students WHERE id=$id"); $edit_record = $res->fetch_assoc(); } ?> Student Mark Sheet

Student Mark Sheet

Cancel
num_rows > 0): ?> fetch_assoc()): ?>
ID Name Math Science English Total Actions
Edit | Delete
No records found.