If document.getElementById("countdowntimer").innerHTML is ‘0’ then move to next recordset, i have set div class="area" with 100% height 100% with overflow hidden in html, body, i want show recordset one by one with interval time.
<?php
$mysqli = new mysqli("localhost", "root", "", "learningbydoing");
$result = mysqli_query($mysqli, "SELECT * FROM question");
while($record = mysqli_fetch_array($result)){
echo '<div class="area">
<div class="boxquestion">
<label>'.$record['no'].'</label><br>
<label>'.$record['question'].'</label><br>
<label id="countdowntimer">'.$record['time'].'</label><br>
</div></div>';
}?>
2
Answers
If you were to fetch the entire recordset using
fetch_all()
you could use that to generate a JSON variable which you could then process easily with Javascript using aninterval
/timer
of some sort. For instance, your PHP might look like:The generated json ( the following is random sports from one of my databases to emulate possible data from your database. ) could then be used as in the following snippet. Try running the snippet…
example: