Server : Apache System : Linux server1.cgrithy.com 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64 User : nobody ( 99) PHP Version : 8.1.23 Disable Function : NONE Directory : /home/dnlcambodia/public_html/dnl_dashboard/PHP/ |
<?php include './config/db_conn.php'; // Check if a delete request has been made if (isset($_GET['id']) && is_numeric($_GET['id'])) { // Escape user input to prevent SQL injection $id = $conn->real_escape_string($_GET['id']); // SQL to delete a record $sql = "DELETE FROM posts WHERE id = $id"; if ($conn->query($sql) === TRUE) { echo "Record deleted successfully"; } else { echo "Error deleting record: " . $conn->error; } } // Close connection $conn->close(); ?>