Php for loading screen


#1

I downloaded the loadingscreen form loadingscreen

i want to show how much police, medic and so on is on my server when you enter. I did change the sql to my database (ESX) but on load it still shows 0 while there is one taxi in server. can someone help me ?

<?php

    $url  = "http://oasisisland.ml:30120/players.json";
    $ip   = "127.0.0.1";
    $user = "root";
    $pass = "XXXXX";
    $data = "essentialmode";



    $jsonData = @file_get_contents($url);
    if($jsonData === false) {
        echo "<span style='float: right;margin-top: -35px;' class='label label-danger'>Le serveur est fermé</span>";
    } else {
        $data = json_decode($jsonData, true);
        $id = array();
        foreach ($data as $value) {
            echo $value['name'] . "<br />";
            array_push($id, $value['identifiers'][0]);

        }
        echo "<hr style='float:left;width: 250px !important;border-color: #52537e; ' /><br />";
        $con=mysqli_connect($ip,$user,$pass,$data);
		if (mysqli_connect_errno())
		{
			echo "Failed to connect to MySQL: " . mysqli_connect_error();
		}
        $query = mysqli_query($con, "SELECT users.identifier FROM users INNER JOIN jobs ON users.job = jobs.name WHERE jobs.name = 'police'");
        $total = 0;
        while($row = mysqli_fetch_array($query)) {
           if(in_array($row[0],$id)) {
               $total++;
           }
        }
        echo "<span style='color: cornflowerblue;'>Police : " . $total . "</span><br />";

        $query = mysqli_query($con, "SELECT users.identifier FROM users INNER JOIN jobs ON users.job = jobs.name WHERE jobs.name = 'ambulance';");
        $total = 0;
        while($row = mysqli_fetch_array($query)) {
            if(in_array($row[0],$id)) {
                $total++;
            }
        }
        echo "<span style='color: orangered;'>Ambulancier : " . $total . "</span><br />";

        $query = mysqli_query($con, "SELECT users.identifier FROM users INNER JOIN jobs ON users.job = jobs.name WHERE jobs.name = 'mecano';");
        $total = 0;
        while($row = mysqli_fetch_array($query)) {
            if(in_array($row[0],$id)) {
                $total++;
            }
        }
        echo "<span style='color: greenyellow;'>Mécano : " . $total . "</span><br />";
		
        $query = mysqli_query($con,"SELECT users.identifier FROM users INNER JOIN jobs ON users.job = jobs.name WHERE jobs.name = 'taxi'");
		$total = 0;
        while($row = mysqli_fetch_array($query)) {
            if(in_array($row[0],$id)) {
                $total++;
            }
        }
        echo "<span style='color: lightpink;'>Taxi : " . $total . "</span>";
    }
?>

thanks in advance


#2

Did u managed to fix the problem ? If you did can you give me some information about it i would appreciate it alot !