PK

ADDRLIN : /home/anibklip/aelogifts.com/cms/
FLL :
Current File : /home/anibklip/aelogifts.com/cms/cate_view.php

<?php
if($_GET['saction']=="del" && is_numeric($_GET['ctid'])){
	$query = "DELETE from cate where ctid = '$_GET[ctid]' ";
	mysqli_query($conn, $query) or die(mysqli_error($conn));

	$_SESSION['errmsg']="Record deleted successfully.";

	echo "<script>window.location.href='main.php?action=cate_view'</script>";
	die;
}
$query = "SELECT * from cate where ctid = '$_GET[ctid]'";
$query = mysqli_query($conn, $query) or die(mysqli_error($conn));
if ($editrow = mysqli_fetch_array($query)) {
}

if($_SESSION['msg']){$msg=$_SESSION['msg']; unset($_SESSION['msg']);}
if($_SESSION['errmsg']){$errmsg=$_SESSION['errmsg']; unset($_SESSION['errmsg']);}
?>
<div class="content-wrapper">
	<!-- Content Header (Page header) -->
	<section class="content-header">
		<div class="container-fluid">
			<div class="row mb-2">
				<div class="col-sm-6">
					<h1>View Categories</h1>
				</div>
				<div class="col-sm-6">
					<ol class="breadcrumb float-sm-right">
						<li class="breadcrumb-item"><a href="#">Home</a></li>
						<li class="breadcrumb-item active">View Categories</li>
					</ol>
				</div>
			</div>
		</div><!-- /.container-fluid -->
	</section>

	<!-- Main content -->
	<section class="content">

		<div class="row">
			<div class="col-md-12">
				<?php if($msg){?><div class="alert alert-success"><strong>Success!</strong> <?php echo $msg;?></div><?php }?>
				<?php if($errmsg){?><div class="alert alert-danger"><strong>Error!</strong> <?php echo $errmsg;?></div><?php }?>
				
				<div class="card card-outline card-info">
					<!-- <div class="card-header">
						<h3 class="card-title">Body</h3>
					</div> -->
					<!-- /.card-header -->
					<!-- /.card-header -->
					<div class="card-body">
						<table id="example2" class="table table-bordered table-striped">
							<thead>
								<tr>
									<th>#</th>
									<th>Category</th>
									<th>Parent Category</th>
									<th>Action(s)</th>
								</tr>
							</thead>
							<tbody>
								<?php
								$query = "SELECT c.*, pc.bname as parent from cate as c
									LEFT JOIN cate as pc ON c.parent_id=pc.ctid
									order by bname
								";
								$query = mysqli_query($conn, $query) or die(mysqli_error($conn));
								$cnt=1;
								while ($row = mysqli_fetch_array($query)) {
									?>
									<tr>
										<td width="60"><?php echo $cnt;?></td>
										<td><?php echo $row['bname'];?></td>
										<td><?php echo ($row['parent']?$row['parent']:"-");?></td>
										<td width="130">
											<a href="main.php?action=cate_add&ctid=<?php echo $row['ctid'];?>" class="btn btn-info"><i class="fas fa-pencil-alt"></i></a>
											<a href="javascript:;" onclick="del('main.php?action=cate_view&saction=del&ctid=<?php echo $row['ctid'];?>')" class="btn btn-danger"><i class="fas fa-solid fa-trash"></i></a>
										</td>
									</tr>
									<?php
									$cnt++;
								}
								?>
							</tbody>
							<!-- <tfoot>
								<tr>
									<th>#</th>
									<th>Category</th>
									<th>Action(s)</th>
								</tr> -->
							</tfoot>
						</table>
					</div>
					<!-- /.card-body -->
				</div>
			</div>
			<!-- /.col-->
		</div>
	</section>
	<!-- /.content -->
</div>


PK 99