Location: PHPKode > projects > EZphotopress > ezphotopress-1.0.0/admin/categories/deleteCategory.php
<h3><?=DELETECATEGORY_TITLE?></h3>
<?php
if (isset($catid) && $catid != "" && $catid > 0 && is_numeric($catid)) {
	//try to see if this category is used in some candy
	$query = $db->query("select count(id) as total from ".TABPREFIX."projects where id_category=".$catid);
	$row = $query->fetch();

	//get category data
	$queryName = $db->query("select name from ".TABPREFIX."categories where id=".$catid);
	$rowName = $queryName->fetch();
	
	if ($row['total'] == 0) {
		//delete category
		$db->query("delete from ".TABPREFIX."categories where id=".$catid);
	
		?>
		<p class="ok">
			<?=DELETECATEGORY_SUCCESS_1?><?php echo strtoupper($rowName['name']); ?><?=DELETECATEGORY_SUCCESS_2?>
		</p>
		<br>
		<br>
		<br>
		<center>
			<a href="home.php?id=cate&action=manage&type=d" class="back"><?=DELETECATEGORY_LINK?></a>
		</center>
<?php
	} else {
		?>
		<p class="ok">
			<?=DELETECATEGORY_ERROR_1?><?php echo strtoupper($rowName['name']); ?><?=DELETECATEGORY_ERROR_2?>
		</p>
		<br>
		<br>
		<br>
		<center>
			<a href="home.php?id=cate&action=manage&type=d" class="back"><?=DELETECATEGORY_LINK?></a>
		</center>
		<?php
	}
}
?>
Return current item: EZphotopress