Skip to content

Instantly share code, notes, and snippets.

@Anas-jaf
Created May 23, 2021 14:30
Show Gist options
  • Save Anas-jaf/2bb04c1923a7688d945a61009bd5c30e to your computer and use it in GitHub Desktop.
Save Anas-jaf/2bb04c1923a7688d945a61009bd5c30e to your computer and use it in GitHub Desktop.
<?php
include('includes/dbconnection.php');
function sort(){
$query=mysqli_query($con, "SELECT avg , sec FROM request");
$row=mysqli_fetch_array($query);
if ($row['sec'] == 'علمي'){
$query1=mysqli_query($con, "SELECT spec FROM majors where min <= $row[avg]");
$row1=mysqli_fetch_array($query1);
foreach ($row1 as $key => $value) {
echo $value;
}
}else{
$query1=mysqli_query($con, "SELECT spec FROM majors where min <= $row[avg] and id_m not BETWEEN 302 and 432 and id_m not between 1101 and 1104 and id_m not between 2201 and 2203 and id_m != 1703");
$row1=mysqli_fetch_array($query1);
foreach ($row1 as $key => $value) {
echo $value;
}
}
}
function countFathJob(){
$query2=mysqli_query($con, "SELECT jop_sec FROM request");
$row2=mysqli_fetch_array($query2);
$administrator=0;
$teachers=0;
foreach ($row2 as $key => $value) {
if ($row1[0] == "إداري"){
$administrator +=1
}
else{
$teacher +=1
}
}
echo "number of administrators is $administrator and number of teachers is $teachers \n";
echo "<br>";
}
sort()
countFathJob()
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment