daily pastebin goal
43%
SHARE
TWEET

Untitled

a guest Oct 17th, 2018 133 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     $host_name = "localhost:3307";
  3.     $database = "weather";
  4.     $user_name = "weather_update";
  5.     $password = "lolpassword";
  6.  
  7.  
  8.     $connect = mysqli_connect($host_name, $user_name, $password, $database);
  9.  
  10.     if(mysqli_connect_errno()){
  11.         echo "La connexion au serveur MySQL a échoué: " .mysqli_connect_error() . "<br>";
  12.     }
  13.     else{
  14.         echo 'Connexion au serveur MySQL établie avec succès.<br>';
  15.         //mysql_select_db("weather");
  16.         $read = mysql_query("SELECT * FROM metrics");
  17.         if (!$result) {
  18.             die("Requête invalide : " . mysql_error() . "<br>");
  19.         }
  20.         else{
  21.             while ($donnees = mysql_fetch_array($read)){
  22.                 echo $donnees['timestamp'] . " : " . $donnees['temperature'] ."<br>";
  23.             }
  24.         }      
  25.  
  26.         mysql_free_result($result);
  27.  
  28.     }
  29. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top