Mini Shell

Direktori : /home/haworld/www/admin/
Upload File :
Current File : /home/haworld/www/admin/cartridges-category-all.php

<!DOCTYPE html>
<html lang="en">

<head>
    <?php include('include/head_admin.php');
    $page_id = '6';


    if (isset($_GET['type']) && $_GET['type'] != '') {
        $type = get_safe_value($con, $_GET['type']);
        if ($type == 'status') {
            $operation = get_safe_value($con, $_GET['operation']);
            $id = get_safe_value($con, $_GET['id']);
            if ($operation == 'active') {
                $status = '1';
            } else {
                $status = '0';
            }
            $update_status_sql = "update cartridges_category set status='$status' where id='$id'";
            mysqli_query($con, $update_status_sql);
        }

        if ($type == 'delete') {
            $id = get_safe_value($con, $_GET['id']);

            $select_sql = "SELECT image FROM cartridges_category WHERE id='$id'";

            $delete_sql = "DELETE FROM cartridges_category WHERE id='$id'";
            mysqli_query($con, $delete_sql);

            header('Location: cartridges-category-all.php');
            // $delete_sql = "delete from category where id='$id'";
            // mysqli_query($con, $delete_sql);
        }
    }

    $sql = "select * from cartridges_category ";
    $res = mysqli_query($con, $sql);
    ?>
</head>

<body>
    <!--== MAIN CONTRAINER ==-->
    <?php include('include/header_admin.php'); ?>

    <!--== BODY CONTNAINER ==-->
    <div class="container-fluid sb2">
        <div class="row">

            <?php include('include/sidebar_admin.php'); ?>

            <div class="sb2-2">
                <div class="sb2-2-2">
                    <ul>
                        <li><a href="index.php"><i class="fa fa-home" aria-hidden="true"></i> Home</a>
                        </li>
                        <li class="active-bre"><a href="cartridges-category-all.php"> cartridges_category</a>
                        </li>
                    </ul>
                </div>
                <div class="sb2-2-1">
                    <h2>All Categories</h2>
                    <table class="table">
                        <thead>
                            <tr>
                                <th>#</th>
                                <th>Name</th>
                                <th>Edit</th>
                                <th>Delete</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            $i = 1;
                            while ($row = mysqli_fetch_assoc($res)) { ?>
                                <tr>
                                    <td><?php echo $i++ ?></td>
                                    <td><?php echo $row['name'] ?></td>
                                  
                                    <td><a href="cartridges-category-add.php?id=<?php echo $row['id']; ?>" class="sb2-2-1-edit"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></a>
                                    </td>
                                    <td><a href="?type=delete&id=<?php echo $row['id'] ?>" class="sb2-2-1-edit"><i class="fa fa-trash-o" aria-hidden="true"></i></a>
                                    </td>
                                </tr>
                            <?php } ?>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

    <?php include('include/footer_admin.php'); ?>

    <?php include('include/foot_admin.php'); ?>

</body>


</html>