| Current Path : /home/bolconlineco/public_html/aaaaaa/demo/admin/ |
| Current File : /home/bolconlineco/public_html/aaaaaa/demo/admin/delete_topic.php |
<?php
ob_start();
session_start();
?>
<?php
include('../includes/connection/func.inc.php');
if(isset($_GET['id']) && isset($_GET['course_id']))
{
$catId=sql_strip($_GET['catId']);
$id = sql_strip($_GET['id']);
$course_id=sql_strip($_GET['course_id']);
$sql="select * from topicassignment where topicId='$id'";
$topicResult=mysql_query($sql) or die(mysql_error());
$sql1="select * from topicstudy where topicId='$id'";
$topicStudy=mysql_query($sql1) or die(mysql_error());
if(mysql_num_rows($topicResult) > 0 || mysql_num_rows($topicStudy) > 0)
{
while($ass=mysql_fetch_array($topicResult))
{
if(file_exists('Assignment/'.$ass['path']))
{
unlink('Assignment/'.$ass['path']);
}
}
while($mat=mysql_fetch_array($topicStudy))
{
if(file_exists('StudyMaterials/'.$mat['path']))
{
unlink('StudyMaterials/'.$mat['path']);
}
}
$query="delete from topicassignment where topicId='$id'";
$result=mysql_query($query) or die(mysql_error());
$query1="delete from topicstudy where topicId='$id'";
$result1=mysql_query($query1) or die(mysql_error());
$query2="delete from topic where topicId='$id'";
$result=mysql_query($query2) or die(mysql_error());
$msg="Topic Deleted Successfully";
header("location:topic.php?cat_id=$catId&courseId=$course_id &msg=$msg");
exit();
}else
{
$sq="delete from topic where topicId='$id' and courseId='$course_id'";
$result=mysql_query($sq) or die(mysql_error());
$msg="Deleted Successfully";
header("location:topic.php?cat_id=$catId&courseId=$course_id&msg=$msg");
exit();
}
}
?>