J'ai un petit problème pour afficher des données, le php ne marche pas ou me renvoie un 0 à la place.
Le code source php :
<?php
include("php/db.php");
$gethum = $bdd->query("SELECT 'humidity' FROM '00000001' ORDER BY 'timeStamp' DESC");
$gethum->fetch();
$gettemp = $bdd->query("SELECT 'temperature' FROM '00000001' ORDER BY 'timeStamp' DESC");
$gettemp->fetch();
$hum=floatval($gethum);
$temp=floatval($gettemp);
?>
Le code de la page en php : <?php
session_start();
include("php/donnees.php");
include("php/profil.php");
if (!isset($_SESSION['id'])) {
header ('Location: connexion.php');
exit();
}
?>
<html>
<head>
<title>XXXXXXXXX</title>
<meta name="author" content="Quentin XXXXXXX">
<meta charset="utf-8">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<?php require "html/header.php"; ?>
<div id="actualisez_moi">
<div class="container">
<div class="row" style="margin-left:0px; padding-top:20px;margin-right:0px; ">
<div class="col-sm-12" style="margin-left:0px; margin-right:0px; width:100%;" >
<div class="col-sm-3 block" style="opacity:0;"><table class="donnes"border="0" cellspacing="0" cellpadding="0">
<tr>
<td > <h2>Humidité</h2> </td>
</tr></table></div>
<div class="col-sm-3 block">
<table class="donnes" border="0" cellspacing="0" cellpadding="0" >
<tr >
<td> <h2 >Température</h2> </td>
</tr>
<?php
echo '<tr ><td style="text-align:center;font-size:2em;font-color:#4f4f4f;"><i class="fas fa-thermometer-half" style="margin-right:8px;color:#AC92EC"></i>'. $temp .'°</td></tr>';
?>
</table>
</div>
<div class="col-sm-3 block" style="opacity:1">
<table class="donnes" border="0" cellspacing="0" cellpadding="0">
<tr>
<td > <h2>Humidité </h2> </td>
</tr>
<?php
echo '<tr ><td style="font-size:2em;font-color:#4f4f4f;"><i class="fa fa-tint" style="margin-right:8px;color:#4FC1E9"></i>'. $hum .'%</td></tr>';
?>
</table>
</div>
<div class="col-sm-3 block" style="opacity:0"><table class="donnes" border="0" cellspacing="0" cellpadding="0">
<tr>
<td > <h2>Humidité</h2> </td>
</tr></table></div>
</div>
</div>
</div>
</div>
<?php require "html/footer.html"; ?>
</body>
</html>
Merci d'avance de votre aide