<pre><?php //including the database connection file include("config.php"); $conn= mysqli_connect("localhost", "root", "", "live"); $result = mysqli_query($mysqli, "SELECT * FROM timer ORDER BY id DESC"); while($res = mysqli_fetch_array($result)) { $date = $res['date']; $h = $res['h']; $m = $res['m']; $s = $res['s']; } if(isset($_POST['submit'])){ echo " <p id='demo'> <script> var countDownDate = * 1000; var now = * 1000; // Update the count down every 1 second var x = setInterval(function() { now = now + 1000; // Find the distance between now an the count down date var distance = countDownDate - now; // Time calculations for days, hours, minutes and seconds var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); // Output the result in an element with id='demo' document.getElementById('demo').innerHTML = days + 'd ' + hours + 'h ' + minutes + 'm ' + seconds + 's '; // If the count down is over, write some text if (distance < 0) { clearInterval(x); document.getElementById('demo').innerHTML = 'EXPIRED'; } }, 1000); </script></p> ";} ?>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)