Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

Copy Clear
Copy Format Clear
<?php include 'config.php'; error_reporting(E_ALL); ini_set('display_errors', 1); echo "Received ID: " . $_POST['id']; if (isset($_POST['id'])) { $class_id = $_POST['id']; // Add this line to check the received ID echo "Received ID: " . $class_id; $stmt = $conn->prepare("DELETE FROM `class` WHERE class_id = ?"); $stmt->bind_param("i", $class_id); // Use "i" for integer parameter $stmt->execute(); if ($stmt->affected_rows > 0) { // Add this line to check if the delete query is successful echo "Class deleted successfully"; } else { // Add this line to check if the delete query fails echo "Failed to delete class"; } } else { echo "Invalid class ID"; } ?>
Copy Clear