
<?php 
    include('../../../../db_connect.php');
    $sq = "SELECT COUNT(*) as num FROM gatepass WHERE status = '0'"; 
    $pgs = mysql_fetch_array(mysql_query($sq));
    $count = $pgs['num'];
    
    $sq1 = "SELECT COUNT(*) as num FROM gatepass WHERE status = '1' AND end_date < NOW() AND reported IS NULL"; 
    $pgs1 = mysql_fetch_array(mysql_query($sq1));
    $count1 = $pgs1['num'];
    
    $sq1x = "SELECT COUNT(*) as num FROM school_leave WHERE status = '1' AND to_date < NOW() AND reported IS NULL"; 
    $pgs1x = mysql_fetch_array(mysql_query($sq1x));
    $count1x = $pgs1x['num'];
    
    $sqx = "SELECT COUNT(*) as num FROM school_leave WHERE status = '0'"; 
    $pgsx = mysql_fetch_array(mysql_query($sqx));
    $countx = $pgsx['num'];
    
    $counted = $count+$count1+$count1x+$countx;
    if($counted <= 0){echo '';}else {echo $counted;}
?>

