require_once("../database.php");
require_once("adminfuncties.php");
require_once("cat_navigatie.php");
if(isset($_POST[s1]))
{
if(empty($_POST[DelCat]))
{
echo "
Selecteer een categorie.";
}
else
{
$q1 = "select * from oneshop_producten where ItemCategory = '$_POST[DelCat]' ";
$r1 = mysql_query($q1) or die(mysql_error());
if(mysql_num_rows($r1) == '0')
{
$q2 = "delete from oneshop_categories where CategoryID = '$_POST[DelCat]' ";
mysql_query($q2) or die(mysql_error());
echo "
De geselecteerde categorie werd succesvol verwijderd...";
}
else
{
while($a1 = mysql_fetch_array($r1))
{
if(!empty($a1[ItemImage]))
{
unlink("../items_images/$a1[ItemImage]");
}
$q2 = "delete from oneshop_producten where ItemID = '$a1[ItemID]' ";
mysql_query($q2) or die(mysql_error());
}
$q3 = "delete from oneshop_categories where CategoryID = '$_POST[DelCat]' ";
mysql_query($q3) or die(mysql_error());
echo "
De geselecteerde categorie werd succesvol verwijderd...";
}
}
}
$q1 = "select * from oneshop_categories order by CategoryName";
$r1 = mysql_query($q1) or die(mysql_error());
if(mysql_num_rows($r1) > '0')
{
echo "\n\n";
echo "Alle producten zullen ook verwijderd worden!";
echo "\n\n";
}
?>