<?php include('site-header.php'); ?>

<?php include('left-nevigation.php'); ?>

   <main id="playground">

 <?php include('site-top-header.php'); ?>

 <?php  $cat_id=$_REQUEST['cat_id']; ?>

      <?php

$psql="select * from tbl_category where cate_parent_id='$cat_id'";

$pdata=mysqli_query($link,$psql);

$Presult=mysqli_fetch_array($pdata);

$catp_id=$Presult['cate_parent_id'];

$sqlcat="select * from tbl_category where cat_id='$catp_id'";

$datacat=mysqli_query($link,$sqlcat);

$resultcat=mysqli_fetch_array($datacat);

?>

<section id="page-title" class="row">

      <div class="col-md-8">

        <h1><?php echo $resultcat['category_name']; ?></h1>

        <p class="lead">View / Edit your product below</strong>.</p>

      </div>

 

      <div class="col-md-4">

        <ol class="breadcrumb pull-right no-margin-bottom">

          

          <li><a href="dashboard.php">Dashboard</a></li>

          <li class="active">Update Products</li>

        </ol>

      </div>

    </section>

	

<?php

if(isset($_REQUEST['del'])){

$sql="delete from tbl_category where cat_id=$_REQUEST[del]";  

$sqldat=mysqli_query($link,$sql);

}

?>

<?php

$sql="select * from tbl_category where cate_parent_id='$cat_id'";

$data=mysqli_query($link,$sql);

?>	

    <!-- / PAGE TITLE -->

    <div class="container-fluid">

      <div class="">

        <a href="show-product.php" class="btn btn-primary">Back</a>

      </div>

      <div class="row">

        <div class="col-md-12">

          <section class="panel panel-primary">

            <header class="panel-heading">

              <h3 class="panel-title">Your Products</h3>

            </header>

            <table class="table table-hover table-responsive">

            <tbody>

              <tr>

                <th scope="row">S. No</th>

                <td>Product Name</td>

                <td>Products Image</td>

                <td>Action</td>

              </tr>

              <tr>

               <?php

			   $i=0;

			   while($result=mysqli_fetch_array($data)){ 

				$i++;

				?>

                <th scope="row"><?php echo $i ?></th>

                <td><?php echo $result['category_name']; ?></td>

                

                <td><img src="../uploaded/<?php echo $result['category_image_name']; ?>" class="img-responsive" style="height:90px; width:130px;;"></td>

                <td><a href="add-products.php?Updt_id=<?php echo $result['cat_id'];?>&cat_id=<?php echo $cat_id ?>" class="btn btn-primary" style="width:100px;">Edit</a><br>

                <form method="post">

                <input type="hidden" name="del" value="<?php echo $result['cat_id'];?>">

                  <button class="btn btn-danger" style="width:100px;">Delete</button> </td>

            </form>

              </tr>

              <?php } ?>

           

            </tbody>

            </table>

          </section>

        </div>

      </div>

    </div>

    <!-- / container-fluid -->

 <?php include('site-footer.php'); ?>