<?php 
function countadvancelevel(){
  $servername = "localhost";
  $username = "marsalog_mahran";
  $password = "gX-;hjZN-B*u";
  $dbname = "marsalog_shipping_clearance_db";
  
  $conn = new mysqli($servername, $username, $password, $dbname);
  if ($conn->connect_error) {
      die("Connection failed: " . $conn->connect_error);
  }
  $sql_num_level="SELECT * FROM hr_advance_level_tbl";
  $result_num_level = $conn->query($sql_num_level);
  $rowcount=mysqli_num_rows($result_num_level);


  return $rowcount;
}

function getnumlevel($id){
  $servername = "localhost";
  $username = "marsalog_mahran";
  $password = "gX-;hjZN-B*u";
  $dbname = "marsalog_shipping_clearance_db";
  
  $conn = new mysqli($servername, $username, $password, $dbname);
  if ($conn->connect_error) {
      die("Connection failed: " . $conn->connect_error);
  }
$ar = array();
$sql_j = "SELECT * FROM hr_advance_level_tbl ";
 $result_j = $conn->query($sql_j);
  if ($result_j->num_rows > 0) {
  while($row_j = $result_j->fetch_assoc()) {
    $d = $row_j["level"];
    $ar[$d] = $row_j["level"];
    
  }}


  return $ar[$id];
}
function getemployacceptid($id){
  $servername = "localhost";
  $username = "marsalog_mahran";
  $password = "gX-;hjZN-B*u";
  $dbname = "marsalog_shipping_clearance_db";
  
  $conn = new mysqli($servername, $username, $password, $dbname);
  if ($conn->connect_error) {
      die("Connection failed: " . $conn->connect_error);
  }
$ar = array();
$sql_j = "SELECT * FROM hr_level_employ_approval where level='$id' ";
 $result_j = $conn->query($sql_j);
  if ($result_j->num_rows > 0) {
  while($row_j = $result_j->fetch_assoc()) {
    array_push($ar,$row_j["employ_id"]);
  }}


  print_r($ar);
}
function getstatdetailsAR($id){
  $servername = "localhost";
  $username = "marsalog_mahran";
  $password = "gX-;hjZN-B*u";
  $dbname = "marsalog_shipping_clearance_db";
  
  $conn = new mysqli($servername, $username, $password, $dbname);
  if ($conn->connect_error) {
      die("Connection failed: " . $conn->connect_error);
  }
  $ar = array();
  $sql_j = "SELECT * FROM hr_advance_level_tbl ";
   $result_j = $conn->query($sql_j);
    if ($result_j->num_rows > 0) {
    while($row_j = $result_j->fetch_assoc()) {
      $d = $row_j["level"];
      $ar[$d] = $row_j["level_stat_details_ar"];
      
    }}
 

    return $ar[$id];
  }
  function getstatdetailsEN($id){
    $servername = "localhost";
$username = "marsalog_mahran";
$password = "gX-;hjZN-B*u";
$dbname = "marsalog_shipping_clearance_db";

$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
    $ar = array();
    $sql_j = "SELECT * FROM hr_advance_level_tbl ";
     $result_j = $conn->query($sql_j);
      if ($result_j->num_rows > 0) {
      while($row_j = $result_j->fetch_assoc()) {
        $d = $row_j["level"];
        $ar[$d] = $row_j["level_stat_details_en"];
        
      }}
   

    return $ar[$id];
    }
echo getemployacceptid(2);
?>