I'm doing a web application that displays a cam stream, however whenever I use it, it's necessary to reload the page, and I need it to happen automatically.
My idea is to dynamically run a query in the database using php , for the refresh page when the dial field value equals "0".
My attempt was as follows:
<?php
$sql = "select dial from ipstream where idusuario = '7';";
while(true)
{
$retorno = mysqli_query($conexao, $sql);
$linha = mysqli_fetch_assoc($retorno);
if($linha['dial'] == "1")
{
$sql = "update ipstream set dial = '0' where idusuario = '7';";
mysqli_query($conexao, $sql);
echo "<script>location.reload();</script>";
}
}
?>