Mysql
 sql >> Datenbank >  >> RDS >> Mysql

Live-Update von MySQL-Daten

Hat funktioniert, danke für die Hilfe an alle.

Javascript

$(document).ready(function(){    
    loadstation();
});

function loadstation(){
    $("#station_data").load("station.php");
    setTimeout(loadstation, 2000);
}

station.php

<?php
include ("database.php");

$result = mysqli_query($con, "SELECT * FROM sql347511.1 ORDER BY ID DESC LIMIT 1;");

while ($row = mysqli_fetch_array($result))
    {
    echo "<div class='infobox_data' id='infobox_temp'>" . $row['TEMP'] . "&deg;C</div>";
    echo "<div class='infobox_data' id='infobox_humid'>" . $row['HUMID'] . "%</div>";
    echo "<div class='infobox_time'>At " . date("g:i:s a F j, Y ", strtotime($row["TIME"])) . "</div>";
    }

mysqli_close($con);
?>

Wohin mit den Daten

<div id="station_data"></div>