PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
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"; } ?>
Show:  
Copy Clear