1
0
Fork 0

„index.php“ ändern

This commit is contained in:
Manuel Kamper 2023-06-24 13:33:36 +00:00
parent afb3004a20
commit a9ce8cd789
1 changed files with 5 additions and 2 deletions

View File

@ -27,15 +27,18 @@ from (
from solardata) as subquery
where row_num = 1
order by last_update desc limit 7 offset 7) as weeksub";
$sql4 = "SELECT today FROM `solardata` WHERE last_update >= Date(NOW()) - INTERVAL 1 DAY AND last_update < Date(NOW()) AND today <> 0.0 ORDER BY last_update DESC LIMIT 1";
$result = $conn->query($sql);
$result2 = $conn->query($sql2);
$result3 = $conn->query($sql3);
$result4 = $conn->query($sql4);
if ($result->num_rows > 0 && $result2->num_rows >0 && $result3->num_rows) {
if ($result->num_rows > 0 && $result2->num_rows >0 && $result3->num_rows && $result4->num_rows) {
while($row = $result->fetch_assoc()) {
$row2 = $result2->fetch_assoc();
$row3 = $result3->fetch_assoc();
$jsonres = array("today"=>$row["today"], "week"=>$row2["week"], "last_week"=>$row3["week"], "month"=>$row["month"], "year"=>$row["year"], "lifetime"=>$row["lifetime"], "current"=>$row["current"], "last_update"=>$row["last_update"]);
$row4 = $result4->fetch_assoc();
$jsonres = array("today"=>$row["today"], "yesterday"=>$row4["today"], "week"=>$row2["week"], "last_week"=>$row3["week"], "month"=>$row["month"], "year"=>$row["year"], "lifetime"=>$row["lifetime"], "current"=>$row["current"], "last_update"=>$row["last_update"]);
}
} else {
$jsonres = array("Error"=>"No result from database.");