$db1->next_record();
if($db1->num_rows()>0){
$fadd     = $db1->f('fld_add');
$fedit    = $db1->f('fld_edit');
$fdelete  = $db1->f('fld_delete');
$fview    = $db1->f('fld_view');
}
*/
##******************************************************************
if ($_REQUEST['mode'] == "del") {
    $fldId = $_REQUEST['fldId'];
    $delete_query_details = "delete from " . TBL_CATAGORY . " where fldId=" . $fldId;
    $delmsg = $db->query($delete_query_details);
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Catagory Deleted Successfully!";
        $count = $func->totalRows(TBL_CATAGORY);
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
if ($_REQUEST['mode'] == "delAll") {
    //print_r($_POST['check_delete']);
    for ($i = 0; $i < count($_POST['check_delete']); $i++) {
        //print_r($fldPageId);
        //print_r($k);
        $delete_query_details = "delete from " . TBL_CATAGORY . " where fldId=" . $_POST['check_delete'][$i];
        $delmsg = $db->query($delete_query_details);
    }
$srchCond = '';
if (!$searchname) {
    $searchname = $_REQUEST['searchname'];
}
$searchname = addslashes($searchname);
if (strlen($searchname) > 0) {
    $queryString = "searchname={$searchname}";
    $srchCond = "AND fldName like '%" . $searchname . "%'";
}
if ($_REQUEST['mode'] == "del") {
    $fldId = $_REQUEST['fldId'];
    $delete_query_details = "delete from " . TBL_COLLEGE_COACH . " where fldId=" . $fldId;
    $delmsg = $db->query($delete_query_details);
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Team Deleted Successfully!";
        $count = $func->totalRows(TBL_COLLEGE_COACH);
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
if ($_REQUEST['mode'] == "delAll") {
    for ($i = 0; $i < count($_POST['check_delete']); $i++) {
        $delete_query_details = "delete from " . TBL_COLLEGE_COACH . " where fldId=" . $_POST['check_delete'][$i];
        $delmsg = $db->query($delete_query_details);
    }
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "College Deleted Successfully!";
        $count = $func->totalRows(TBL_COLLEGE_COACH);
$srchCond = '';
if (!$searchname) {
    $searchname = $_REQUEST['searchname'];
}
$searchname = addslashes($searchname);
if (strlen($searchname) > 0) {
    $queryString = "searchname={$searchname}";
    $srchCond = "AND fldClass like '%" . $searchname . "%'";
}
if ($_REQUEST['mode'] == "del") {
    $fldId = $_REQUEST['fldId'];
    $delete_query_details = "delete from " . TBL_CLASS . " where fldId=" . $fldId;
    $delmsg = $db->query($delete_query_details);
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Class Deleted Successfully!";
        $count = $func->totalRows(TBL_CLASS);
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
if ($_REQUEST['mode'] == "delAll") {
    //print_r($_POST['check_delete']);
    for ($i = 0; $i < count($_POST['check_delete']); $i++) {
        $delete_query_details = "delete from " . TBL_CLASS . " where fldId=" . $_POST['check_delete'][$i];
        $delmsg = $db->query($delete_query_details);
    }
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Class Deleted Successfully!";
if (strlen($searchname) > 0) {
    $queryString = "searchname={$searchname}";
    $srchCond = "AND fldTitle like '%" . $searchname . "%'";
}
if ($_REQUEST['mode'] == "del") {
    $fldId = $_REQUEST['fldId'];
    $query_Image = " Select * from " . TBL_BANNER . " where fldId ='" . $fldId . "'";
    $db1->query($query_Image);
    $db1->next_record();
    echo $db1->f('fldImage');
    @unlink('../banner/' . $db1->f('fldImage'));
    $delete_query_details = "delete from " . TBL_BANNER . " where fldId='" . $fldId . "'";
    $delmsg = $db->query($delete_query_details);
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Banner Deleted Successfully!";
        $count = $func->totalRows(TBL_BANNER);
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
if ($_REQUEST['mode'] == "delAll") {
    for ($i = 0; $i < count($_POST['check_delete']); $i++) {
        $query_Image = " Select * from " . TBL_BANNER . " where fldId ='" . $_POST['check_delete'][$i] . "'";
        $db1->query($query_Image);
        $db1->next_record();
        echo $db1->f('fldImage');
        @unlink('../banner/' . $db1->f('fldImage'));
        $delete_query_details = "delete from " . TBL_BANNER . " where fldId='" . $_POST['check_delete'][$i] . "'";
$db1->next_record();
if($db1->num_rows()>0){
$fadd     = $db1->f('fld_add');
$fedit    = $db1->f('fld_edit');
$fdelete  = $db1->f('fld_delete');
$fview    = $db1->f('fld_view');
}
*/
##******************************************************************
if ($_REQUEST['mode'] == "del") {
    $fldId = $_REQUEST['fldId'];
    $delete_query_details = "delete from " . TBL_OTHER . " where fldId=" . $fldId;
    $delmsg = $db->query($delete_query_details);
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Other Deleted Successfully!";
        $count = $func->totalRows(TBL_OTHER);
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
if ($_REQUEST['mode'] == "delAll") {
    //print_r($_POST['check_delete']);
    for ($i = 0; $i < count($_POST['check_delete']); $i++) {
        //print_r($fldPageId);
        //print_r($k);
        $delete_query_details = "delete from " . TBL_OTHER . " where fldId=" . $_POST['check_delete'][$i];
        $delmsg = $db->query($delete_query_details);
    }
$srchCond = '';
if (!$searchname) {
    $searchname = $_REQUEST['searchname'];
}
$searchname = addslashes($searchname);
if (strlen($searchname) > 0) {
    $queryString = "searchname={$searchname}";
    $srchCond = "AND fldSportsname like '%{$searchname}%'";
}
if ($_REQUEST['mode'] == "del") {
    $fldId = $_REQUEST['fldId'];
    $delete_query_details = "delete from " . TBL_SPORTS . " where fldId='" . $fldId . "'";
    $delmsg = $db->query($delete_query_details);
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Sport Deleted Successfully!";
        $count = $func->totalRows(TBL_SPORTS);
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
if ($_REQUEST['mode'] == "delAll") {
    foreach ($_REQUEST['check_delete'] as $key => $fldId) {
        $delete_query_details = "delete from " . TBL_SPORTS . " where fldId='{$fldId}'";
        $delmsg = $db->query($delete_query_details);
    }
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Sports Deleted Successfully!";
        $count = $func->totalRows(TBL_SPORTS);
        }
    }
}
if ($_POST['search'] == 'Search') {
    $fldStartdate = $_POST['fldStartdate'];
    $fldEndDate = $_POST['fldEndDate'];
    $fldcontent = $_POST['fldcontent'];
}
if ($_REQUEST['mode'] == "delAll") {
    foreach ($_REQUEST['check_delete'] as $k => $mail_id) {
        $delete_query_details = "delete from " . TBL_MAIL . " where mail_id='{$mail_id}'";
        $delmsg = $db->query($delete_query_details);
    }
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Message Deleted Successfully!";
        $count = $func->totalRows(TBL_MAIL);
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
if ($_REQUEST['mode'] == "dective") {
    $mail_id = $_REQUEST['mail_id'];
    $active_query_details = "update " . TBL_MAIL . " set visible = 'DECTIVE' where mail_id='" . $mail_id . "'";
    $activemsg = $db->query($active_query_details);
    if (isset($activemsg)) {
        $_REQUEST['msg'] = "Message De-Active Successfully!";
    }
}
    $db1->next_record();
    $db1->num_rows();
    if ($db->num_rows() == 0) {
        $delete_query_details = "delete from " . TBL_ATHLETE_STATS_CATAGORY . " where fldId=" . $fldId;
        $delmsg = $db1->query($delete_query_details);
    } else {
        ?>

		<script type="text/javascript">
		alert("You have to delete its Subcategory first");
		</script>
		<?php 
    }
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Category Deleted Successfully!";
        $count = $func->totalRows(TBL_ATHLETE_STATS_CATAGORY);
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
if ($_REQUEST['mode'] == "delAll") {
    for ($i = 0; $i < count($_POST['check_delete']); $i++) {
        $query_child = " Select * from " . TBL_ATHLETE_STATS_CATAGORY . " where fldParentId =" . $_POST['check_delete'][$i];
        $db1->query($query_child);
        $db1->next_record();
        $db1->num_rows();
        if ($db1->num_rows() == 0) {
            $delete_query_details = "delete from " . TBL_ATHLETE_STATS_CATAGORY . " where fldId=" . $_POST['check_delete'][$i];
    header("Location:login.php");
}
//for paging
$func = new COMMONFUNC();
$page = new Page();
$db = new DB();
$db2 = new DB();
$flag = 0;
//Local Variables
$IsMyProfile = 0;
if ($_REQUEST['mode'] == "del") {
    $delete_query_details = "delete from " . TBL_COLLEGE_NEEDS . " where fldId='" . $_REQUEST['fldId'] . "'";
    $delmsg = $db->query($delete_query_details);
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Need Type successfully deleted.";
        $count = $func->totalRows(TBL_NEEDTYPE);
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
//Detect if this Athlete is Athlete viewing profile
if ($_REQUEST['collegeid'] != '' and $_SESSION['College_Coach_id'] != '' and $_REQUEST['collegeid'] == $_SESSION['College_Coach_id']) {
    $IsMyProfile = 1;
}
#######################################
## SEND NETWORK REQUEST
//Insert, Display Notification, and Email Recipient
$GLOBALPage = "collegeprofile.php?collegeid=";
        $srchCond = "AND ((fldName like '%{$searchname}%') OR (fldSchool = '{$searchteam}'))";
    }
} else {
    if (!$_REQUEST['searchname'] and $_REQUEST['fldSchool'] != 0) {
        $searchteam = $_REQUEST['fldSchool'];
        $srchCond = "AND fldSchool = '{$searchteam}'";
        $flag++;
    }
}
if ($_REQUEST['mode'] == "del") {
    $fldId = $_REQUEST['fldId'];
    $delete_query_details = "delete from " . TBL_HS_AAU_COACH . " where fldId='" . $fldId . "'";
    $delmsg = $db->query($delete_query_details);
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "High School / AAU Coach Deleted Successfully!";
        $count = $func->totalRows(TBL_HS_AAU_COACH);
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
if ($_REQUEST['mode'] == "delAll") {
    foreach ($_REQUEST['check_delete'] as $key => $fldId) {
        $delete_query_details = "delete from " . TBL_HS_AAU_COACH . " where fldId='{$fldId}'";
        $delmsg = $db->query($delete_query_details);
    }
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "High School / AAU Coach Deleted Successfully!";
        $count = $func->totalRows(TBL_HS_AAU_COACH);
/*if(!$searchname){
$searchname=$_REQUEST['searchname'];
}
$searchname = addslashes($searchname);
if(strlen($searchname)>0)
{   $queryString="searchname=$searchname";
	$srchCond= "AND fldEventName like '%".$searchname."%'";
}
*/
if ($_REQUEST['mode'] == "del") {
    $id = $_REQUEST['id'];
    $delete_query_details = "delete from " . $tbl_transportation_discount . " where id=" . $id;
    $delmsg = $db->query($delete_query_details);
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Transportation Discount Deleted Successfully!";
        $count = $func->totalRows($tbl_transportation_discount);
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
if ($_REQUEST['mode'] == "delAll") {
    for ($i = 0; $i < count($_POST['check_delete']); $i++) {
        $delete_query_details = "delete from " . $tbl_transportation_discount . " where id=" . $_POST['check_delete'][$i];
        $delmsg = $db->query($delete_query_details);
    }
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Transportation Discount Deleted Successfully!";
        $count = $func->totalRows($tbl_transportation_discount);
$srchCond = '';
if (!$searchname) {
    $searchname = $_REQUEST['searchname'];
}
$searchname = addslashes($searchname);
if (strlen($searchname) > 0) {
    $queryString = "searchname={$searchname}";
    $srchCond = "AND fldTitle like '%" . $searchname . "%' OR fldDescription like '%" . $searchname . "%'";
}
if ($_REQUEST['mode'] == "del") {
    $fldId = $_REQUEST['fldId'];
    $delete_query_details = "delete from tbl_notes where fldId=" . $fldId;
    $delmsg = $db->query($delete_query_details);
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Note Deleted Successfully!";
        $count = $func->totalRows("tbl_notes");
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
if ($_REQUEST['mode'] == "delAll") {
    for ($i = 0; $i < count($_POST['check_delete']); $i++) {
        $delete_query_details = "delete from tbl_notes where fldId=" . $_POST['check_delete'][$i];
        $delmsg = $db->query($delete_query_details);
    }
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Note Deleted Successfully!";
        $count = $func->totalRows("tbl_notes");
$srchCond = '';
if (!$searchname) {
    $searchname = $_REQUEST['searchname'];
}
$searchname = addslashes($searchname);
if (strlen($searchname) > 0) {
    $queryString = "searchname={$searchname}";
    $srchCond = "AND fldCollegename like '%{$searchname}%'";
}
if ($_REQUEST['mode'] == "del") {
    $fldId = $_REQUEST['fldId'];
    $delete_query_details = "delete from " . TBL_COLLEGE_REGISTER . " where fldId='" . $fldId . "'";
    $delmsg = $db->query($delete_query_details);
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "College Deleted Successfully!";
        $count = $func->totalRows(TBL_COLLEGE_REGISTER);
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
if ($_REQUEST['mode'] == "delAll") {
    foreach ($_REQUEST['check_delete'] as $k => $fldId) {
        $delete_query_details = "delete from " . TBL_COLLEGE_REGISTER . " where fldId='{$fldId}'";
        $delmsg = $db->query($delete_query_details);
    }
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "College Deleted Successfully!";
        $count = $func->totalRows(TBL_COLLEGE_REGISTER);
$srchCond = '';
if (!$searchname) {
    $searchname = $_REQUEST['searchname'];
}
$searchname = addslashes($searchname);
if (strlen($searchname) > 0) {
    $queryString = "searchname={$searchname}";
    $srchCond = "fldStatus=1 AND fldName like '%" . $searchname . "%'";
}
if ($_REQUEST['mode'] == "del") {
    $fldId = $_REQUEST['fldId'];
    $delete_query_details = "delete from " . TBL_COLLEGE . " where fldId=" . $fldId;
    $delmsg = $db->query($delete_query_details);
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "College Deleted Successfully!";
        $count = $func->totalRows(TBL_COLLEGE);
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
if ($_REQUEST['mode'] == "delAll") {
    for ($i = 0; $i < count($_POST['check_delete']); $i++) {
        $delete_query_details = "delete from " . TBL_COLLEGE . " where fldId=" . $_POST['check_delete'][$i];
        $delmsg = $db->query($delete_query_details);
    }
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "College Deleted Successfully!";
        $count = $func->totalRows(TBL_COLLEGE);
$db1->next_record();
if($db1->num_rows()>0){
$fadd     = $db1->f('fld_add');
$fedit    = $db1->f('fld_edit');
$fdelete  = $db1->f('fld_delete');
$fview    = $db1->f('fld_view');
}
*/
##******************************************************************
if ($_REQUEST['mode'] == "del") {
    $fldId = $_REQUEST['fldId'];
    $delete_query_details = "delete from " . TBL_ATHELETE_STAT . " where fldId='" . $fldId . "'";
    $delmsg = $db->query($delete_query_details);
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Athlete Stat Deleted Successfully!";
        $count = $func->totalRows(TBL_ATHELETE_STAT);
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
if ($_REQUEST['mode'] == "delAll") {
    for ($i = 0; $i < count($_POST['check_delete']); $i++) {
        $delete_query_details = "delete from " . TBL_ATHELETE_STAT . " where fldId='" . $_POST['check_delete'][$i] . "'";
        $delmsg = $db->query($delete_query_details);
        if (isset($delmsg)) {
            $_REQUEST['msg'] = "Athlete Stat Deleted Successfully!";
            $count = $func->totalRows(TBL_ATHELETE_STAT);
            $offset = $_REQUEST['page'] * 10;
$srchCond = '';
if (!$searchname) {
    $searchname = $_REQUEST['searchname'];
}
$searchname = addslashes($searchname);
if (strlen($searchname) > 0) {
    $queryString = "searchname={$searchname}";
    $srchCond = "AND fldPageTitle like '%" . $searchname . "%'";
}
if ($_REQUEST['mode'] == "del") {
    $fldPageId = $_REQUEST['fldPageId'];
    $delete_query_details = "delete from " . TBL_PAGE . " where fldPageId='" . $fldPageId . "'";
    $delmsg = $db->query($delete_query_details);
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Page Deleted Successfully!";
        $count = $func->totalRows(TBL_PAGE);
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
if ($_REQUEST['mode'] == "delAll") {
    for ($i = 0; $i < count($_POST['check_delete']); $i++) {
        $delete_query_details = "delete from " . TBL_PAGE . " where fldPageId='" . $_POST['check_delete'][$i] . "'";
    }
    $delmsg = $db->query($delete_query_details);
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Page Deleted Successfully!";
        $count = $func->totalRows(TBL_PAGE);
$srchCond = '';
if (!$searchname) {
    $searchname = $_REQUEST['searchname'];
}
$searchname = addslashes($searchname);
if (strlen($searchname) > 0) {
    $queryString = "searchname={$searchname}";
    $srchCond = "AND fldFirstName like '%" . $searchname . "%' OR fldLastName like '%" . $searchname . "%'";
}
if ($_REQUEST['mode'] == "del") {
    $fldId = $_REQUEST['fldId'];
    $delete_query_details = "delete from " . TBL_SPECIAL_EVENT_REGISTER . " where fldId=" . $fldId;
    $delmsg = $db->query($delete_query_details);
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Special Event Register Deleted Successfully!";
        $count = $func->totalRows(TBL_SPECIAL_EVENT_REGISTER);
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
if ($_REQUEST['mode'] == "delAll") {
    for ($i = 0; $i < count($_POST['check_delete']); $i++) {
        $delete_query_details = "delete from " . TBL_SPECIAL_EVENT_REGISTER . " where fldId=" . $_POST['check_delete'][$i];
        $delmsg = $db->query($delete_query_details);
    }
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Special Event Deleted Successfully!";
        $count = $func->totalRows(TBL_SPECIAL_EVENT_REGISTER);
$srchCond = '';
if (!$searchname) {
    $searchname = $_REQUEST['searchname'];
}
$searchname = addslashes($searchname);
if (strlen($searchname) > 0) {
    $queryString = "searchname={$searchname}";
    $srchCond = "AND fldName like '%" . $searchname . "%'";
}
if ($_REQUEST['mode'] == "del") {
    $fldId = $_REQUEST['fldId'];
    $delete_query_details = "delete from " . TBL_HS_AAU_TEAM_OTHER . " where fldId=" . $fldId;
    $delmsg = $db->query($delete_query_details);
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Other HS / AAU Team Name Deleted Successfully!";
        $count = $func->totalRows(TBL_HS_AAU_TEAM_OTHER);
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
if ($_REQUEST['mode'] == "delAll") {
    //print_r($_POST['check_delete']);
    for ($i = 0; $i < count($_POST['check_delete']); $i++) {
        $delete_query_details = "delete from " . TBL_HS_AAU_TEAM_OTHER . " where fldId=" . $_POST['check_delete'][$i];
        $delmsg = $db->query($delete_query_details);
    }
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Other HS / AAU Team Name Deleted Successfully!";
/*if(!$searchname){
$searchname=$_REQUEST['searchname'];
}
$searchname = addslashes($searchname);
if(strlen($searchname)>0)
{   $queryString="searchname=$searchname";
	$srchCond= "AND fldEventName like '%".$searchname."%'";
}
*/
if ($_REQUEST['mode'] == "del") {
    $fldEventId = $_REQUEST['fldEventId'];
    $delete_query_details = "delete from " . $tbl_coupon . " where id=" . $fldEventId;
    $delmsg = $db->query($delete_query_details);
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Coupon Deleted Successfully!";
        $count = $func->totalRows($tbl_coupon);
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
if ($_REQUEST['mode'] == "delAll") {
    for ($i = 0; $i < count($_POST['check_delete']); $i++) {
        $delete_query_details = "delete from " . $tbl_coupon . " where id=" . $_POST['check_delete'][$i];
        $delmsg = $db->query($delete_query_details);
    }
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Coupon Deleted Successfully!";
        $count = $func->totalRows($tbl_coupon);
                //fclose($jpgpath);
                unlink($jpgpath);
            }
        }
    } else {
        $_REQUEST['msg'] = "Video not deleted, this video does not belong to you";
    }
}
if ($_REQUEST['mode'] == "delAll") {
    for ($i = 0; $i < count($_POST['check_delete']); $i++) {
        $delete_query_details = "delete from " . TBL_ATHLETE_VIDEO . " where fldId=" . $_POST['check_delete'][$i];
        $delmsg = $db->query($delete_query_details);
    }
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Video(s) successfully deleted.";
        $count = $func->totalRows(TBL_ATHLETE_VIDEO);
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
if ($_REQUEST['page'] == '') {
    $pageno = '0';
} else {
    $pageno = $_REQUEST['page'];
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
include "include/ADsessionAdmin.php";
// for admin login
$func = new COMMONFUNC();
//Create an instance of class COMMONFUNC
$page = new Page();
//Create an instance of class Pate
$lnb = "2";
$error_msg = '';
$srchCond = '';
if ($_REQUEST['mode'] == "del") {
    $fldId = $_REQUEST['fldId'];
    $delete_query_details = "delete from " . TBL_BLOCK_MESSAGE . " where fldId='" . $fldId . "'";
    $delmsg = $db->query($delete_query_details);
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Message Block Deleted Successfully!";
        $count = $func->totalRows(TBL_BLOCK_MESSAGE);
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
if ($_REQUEST['mode'] == "delAll") {
    foreach ($_REQUEST['check_delete'] as $k => $fldId) {
        $delete_query_details = "delete from " . TBL_BLOCK_MESSAGE . " where fldId='{$fldId}'";
        $delmsg = $db->query($delete_query_details);
    }
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Message Block Deleted Successfully!";
        $count = $func->totalRows(TBL_BLOCK_MESSAGE);
$srchCond = '';
if (!$searchname) {
    $searchname = $_REQUEST['searchname'];
}
$searchname = addslashes($searchname);
if (strlen($searchname) > 0) {
    $queryString = "searchname={$searchname}";
    $srchCond = "AND fldEventName like '%" . $searchname . "%'";
}
if ($_REQUEST['mode'] == "del") {
    $fldEventId = $_REQUEST['fldEventId'];
    $delete_query_details = "delete from " . TBL_EVENT . " where fldEventId=" . $fldEventId;
    $delmsg = $db->query($delete_query_details);
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Event Deleted Successfully!";
        $count = $func->totalRows(TBL_EVENT);
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
if ($_REQUEST['mode'] == "delAll") {
    for ($i = 0; $i < count($_POST['check_delete']); $i++) {
        $delete_query_details = "delete from " . TBL_EVENT . " where fldEventId=" . $_POST['check_delete'][$i];
        $delmsg = $db->query($delete_query_details);
    }
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Event Deleted Successfully!";
        $count = $func->totalRows(TBL_EVENT);
$srchCond = '';
if (!$searchname) {
    $searchname = $_REQUEST['searchname'];
}
$searchname = addslashes($searchname);
if (strlen($searchname) > 0) {
    $queryString = "searchname={$searchname}";
    $srchCond = "AND fldTitle like '%" . $searchname . "%'";
}
if ($_REQUEST['mode'] == "del") {
    $fldId = $_REQUEST['fldId'];
    $delete_query_details = "delete from " . TBL_HOME_CONTENT . " where fldId='" . $fldId . "'";
    $delmsg = $db->query($delete_query_details);
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Content Deleted Successfully!";
        $count = $func->totalRows(TBL_HOME_CONTENT);
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
if ($_REQUEST['mode'] == "delAll") {
    for ($i = 0; $i < count($_POST['check_delete']); $i++) {
        $delete_query_details = "delete from " . TBL_HOME_CONTENT . " where fldId='" . $_POST['check_delete'][$i] . "'";
    }
    $delmsg = $db->query($delete_query_details);
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Content Deleted Successfully!";
        $count = $func->totalRows(TBL_HOME_CONTENT);
$srchCond = '';
if (!$searchname) {
    $searchname = $_REQUEST['searchname'];
}
$searchname = addslashes($searchname);
if (strlen($searchname) > 0) {
    $queryString = "searchname={$searchname}";
    $srchCond = "fldStatus=1 AND fldName like '%" . $searchname . "%'";
}
if ($_REQUEST['mode'] == "del") {
    $fldId = $_REQUEST['fldId'];
    $delete_query_details = "delete from " . TBL_HS_AAU_TEAM_NAME . " where fldId=" . $fldId;
    $delmsg = $db->query($delete_query_details);
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "HS AAU Team Name Deleted Successfully!";
        $count = $func->totalRows(TBL_HS_AAU_TEAM_NAME);
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
if ($_REQUEST['mode'] == "delAll") {
    for ($i = 0; $i < count($_POST['check_delete']); $i++) {
        $delete_query_details = "delete from " . TBL_HS_AAU_TEAM_NAME . " where fldId=" . $_POST['check_delete'][$i];
        $delmsg = $db->query($delete_query_details);
    }
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "HS AAU Team Deleted Successfully!";
        $count = $func->totalRows(TBL_HS_AAU_TEAM_NAME);
$srchCond = '';
if (!$searchname) {
    $searchname = $_REQUEST['searchname'];
}
$searchname = addslashes($searchname);
if (strlen($searchname) > 0) {
    $queryString = "searchname={$searchname}";
    $srchCond = "AND ((fldFirstname like '%{$searchname}%') or (fldLastname  like '%{$searchname}%'))";
}
if ($_REQUEST['mode'] == "del") {
    $fldId = $_REQUEST['fldId'];
    $delete_query_details = "delete from " . TBL_ATHELETE_REGISTER . " where fldId='" . $fldId . "'";
    $delmsg = $db->query($delete_query_details);
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Athelete Deleted Successfully!";
        $count = $func->totalRows(TBL_ATHELETE_REGISTER);
        $offset = $_REQUEST['page'] * 10;
        if ($count <= $offset) {
            $offset = $offset - $count;
            $_REQUEST['page'] = $offset / 10;
        }
    }
}
if ($_REQUEST['mode'] == "delAll") {
    foreach ($_REQUEST['check_delete'] as $k => $fldId) {
        $delete_query_details = "delete from " . TBL_ATHELETE_REGISTER . " where fldId='{$fldId}'";
        $delmsg = $db->query($delete_query_details);
    }
    if (isset($delmsg)) {
        $_REQUEST['msg'] = "Athlete Deleted Successfully!";
        $count = $func->totalRows(TBL_ATHELETE_REGISTER);