Your IP : 10.1.73.149


Current Path : /home/bolconlineco/public_html/admin/
Upload File :
Current File : //home/bolconlineco/public_html/admin/add_topic.php

<?php 
  ob_start();
  session_start();
  ?>
<?php

include('../includes/connection/func.inc.php');  
  if(isset($_POST['add-topic']))
  
    {
	 
	  $topicname = sql_strip($_POST['topicname']);
	  
	  $topicorder = sql_strip($_POST['topicorder']);
	  
	  $topicstatus = sql_strip($_POST['topicstatus']);
	  
	  
	  $courseId=sql_strip($_POST['courseId']);
	  
	  $ccat_id=sql_strip($_POST['ccat_id']);
	  
	  $sql1="select coursetopic from course where courseId='$courseId'";
	  
	  $result11=mysql_query($sql1) or die(mysql_error());
	  
	   $arr=mysql_fetch_array($result11);
	   $num1=$arr['coursetopic'];
	  
	  $sql22="select topicId from topic where courseId='$courseId'";
	  
	  $result22=mysql_query($sql22) or die(mysql_error());
	  
	  $num2=mysql_num_rows($result22);
	  
	  if($num2 != $num1)
	  
	   {
	  
	  $sql="insert into topic values ('','$courseId','$topicname','$topicorder','$topicstatus')";
	  
	  $result=query($sql);
	  
	  if($result)
	   {
		 $msg = "Inserted Successfully";
		 
		 header("location:topic.php?cat_id=$ccat_id&courseId=$courseId &msg=$msg");
		 
		 exit(); 
	   
	   }else
	   {
		  $msg = "Can't Inserted due to some Errors";
		 
		  header("location:topic.php?cat_id=$ccat_id&courseId=$courseId &msg=$msg");
		 
		  exit(); 
	   }
	  
	   }else
	   {
		  $msg = "You are not allowed to add more topics in this course";
		 
		  header("location:topic.php?cat_id=$ccat_id&courseId=$courseId &msg=$msg");
		 
		  exit();   
	   }	  
	 	
	}

?>