Senin, 20 Januari 2020

Membuat Notif Automatis



<html>
<head>
 
<script type="text/javascript">
function Ajax(){
var $http,$self = arguments.callee;

if (window.XMLHttpRequest) {$http = new XMLHttpRequest();}
else if (window.ActiveXObject) {
try {$http = new ActiveXObject('Msxml2.XMLHTTP');}
catch(e) {$http = new ActiveXObject('Microsoft.XMLHTTP');}
}

if ($http) {
$http.onreadystatechange = function(){
if (/4|^complete$/.test($http.readyState)) {
document.getElementById('ReloadThis').innerHTML = $http.responseText;
setTimeout(function(){$self();}, 1000);
}
};
$http.open('GET', 'cek.php' + '?' + new Date().getTime(), true);
$http.send(null);
}
}
</script>
<script type="text/javascript">setTimeout(function() {Ajax();}, 1000);</script>

</head>

<body>
<ol>
    <li class="nav-item">
        <a class="nav-link" href="index.php?mnu=bayar">
          <i class="fab fa-fw fa-wpforms"></i>
          <span>Bayar  <label id="ReloadThis"><?php echo $ada;?></label></span>
        </a>
      </li>



cek.php

<?php

require_once"konmysqli.php";
 $sql="select `id_parkir` from `$tbparkir` where status='2' ";
  $jum=getJum($conn,$sql);
echo " <font color='red'><sup><b>$jum</b></sup></font>";

function getJum($conn,$sql){
  $rs=$conn->query($sql);
  $jum= $rs->num_rows;
$rs->free();
return $jum;
}

?>


Tidak ada komentar:

Posting Komentar

global_priv WARNING Selalu

 Jika muncul pesan kesalahan: Warning in .\libraries\classes\Dbal\DbiMysqli.php#209  mysqli::query(): (HY000/1034): Index for table 'glo...