<?php
error_reporting(0);
session_start();

include_once('../../../db_connect/db.php');
if(isset($_SESSION['admin_id'])){

	$admin_id = $_SESSION['admin_id'];
}else{
	$admin_id =0;
}
	$student_id=mysqli_real_escape_string($conn_1,$_POST["student_id"]);
	$gender=mysqli_real_escape_string($conn_1,$_POST["gender"]);
	$matric_number=mysqli_real_escape_string($conn_1,$_POST["mat_no"]);
	$type_id=mysqli_real_escape_string($conn_1,$_POST["type_id"]);

	if($type_id=='1')
	{
		$insert = mysqli_query($conn_1,"UPDATE students_prence SET gender='$gender' WHERE id='$student_id'");


									if($insert){

										echo 1;


									} else{

										echo '<div class="alert alert-danger alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button><strong>Alert!</strong> not updated </div>';
									}
	}else if($type_id=='2')
	{
		$insert = mysqli_query($conn_1,"UPDATE students_nce SET gender='$gender' WHERE id='$student_id'");


									if($insert){

										echo 1;


									} else{

										echo '<div class="alert alert-danger alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button><strong>Alert!</strong> not updated </div>';
									}
	}else if($type_id=='3')
	{
		$insert = mysqli_query($conn_2,"UPDATE students_nce SET gender='$gender' WHERE id='$student_id'");


									if($insert){

										echo 1;


									} else{

										echo '<div class="alert alert-danger alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button><strong>Alert!</strong> not updated </div>';
									}
	}else if($type_id=='4')
	{
		$insert = mysqli_query($conn_2,"UPDATE students_udus SET gender='$gender' WHERE id='$student_id'");


									if($insert){

										echo 1;


									} else{

										echo '<div class="alert alert-danger alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button><strong>Alert!</strong> not updated </div>';
									}
	}else if($type_id=='5')
	{
		$insert = mysqli_query($conn_1,"UPDATE summer_students SET gender='$gender' WHERE id='$student_id'");


									if($insert){

										echo 1;


									} else{

										echo '<div class="alert alert-danger alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button><strong>Alert!</strong> not updated </div>';
									}
	}else if($type_id=='6')
	{
		$insert = mysqli_query($conn_1,"UPDATE summer_students SET gender='$gender' WHERE id='$student_id'");


									if($insert){

										echo 1;


									} else{

										echo '<div class="alert alert-danger alert-dismissible" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button><strong>Alert!</strong> not updated </div>';
									}
	}








?>
