1. <?php
  2. // Conexion database
  3. $SQL['address'] = 'localhost';
  4. $SQL['username'] = 'root';
  5. $SQL['password'] = '1234';
  6. $SQL['DB'] = 'dbname';
  7. try
  8. {
  9. $bdd = new PDO('mysql:host=' . $SQL['address'] . ';dbname=' . $SQL['DB'] . ';charset=utf8', $SQL['username'], $SQL['password']);
  10. }
  11. catch (Exception $e)
  12. {
  13. die('Erreur : ' . $e->getMessage());
  14. }
  15. // Récupération des datas
  16. $response = $bdd->query('select * from `T_Log_PingChecker` where `LPC_Compteur` = ( select max(`LPC_Compteur`) from `T_Log_PingChecker`)');
  17. // Affichage des données
  18. while($data = $response->fetch())
  19. {
  20. $Nom = $data['LPC_Nom'];
  21. $resultat = $data['LPC_Resultat'];
  22. $Compteur = $data['LPC_Compteur'];
  23. $ID = $data['LPC_ID'];
  24. if ($resultat > "Online")
  25. {
  26. //echo $Nom . " : " ;
  27. echo "<font color='red'> $Nom </font>" . " : ";
  28. echo $resultat;
  29. echo "<br>";
  30. }
  31. else
  32. {
  33. echo $Nom . " : " ;
  34. echo $resultat;
  35. echo "<br>";
  36. }
  37. }
  38. $response->closeCursor();
  39. ?>

Affichage des résultats