MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 52.14.100.101
Web Server : Apache
System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : ppcad7no ( 715)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home2/ppcad7no/tmp/../chandeshwarcontractors.com/../goldensafe.in/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/ppcad7no/tmp/../chandeshwarcontractors.com/../goldensafe.in/admin/delete-industry.php
<?php
include_once('config.php');

$id = intval($_GET['id']);

// Fetch existing images
$existing_images_query = "SELECT `imgage` FROM `tbl_product` WHERE p_id = $id";
$existing_images_result = $db->query($existing_images_query);
$existing_images_row = $existing_images_result->fetch_assoc();
    
        $image_fields = ['imgage'];
        foreach ($image_fields as $image_field) {
            if (!empty($existing_images_row[$image_field])) {
                $file_path = 'images/' . $existing_images_row[$image_field];
                if (file_exists($file_path)) {
                    unlink($file_path);
                }
            }
        }
        
        // Delete the record from the database
        $causeQuery = "DELETE FROM `tbl_product` WHERE p_id = $id";
        $causeResult = mysqli_query($db, $causeQuery);
        
        if ($causeResult) {
            header('location: manage-industries.php');
            exit;
        } else {
            echo "Failed to delete the record from tbl_services.";
        }
?>

MMCT - 2023