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>';
}?>
My Answer:
To achieve moving to the next recordset after the countdown timer reaches '0' and showing each recordset one by one with an interval time, you can use JavaScript to handle the countdown timer and moving to the next recordset.
Here is an example code snippet that demonstrates this functionality:
html
$mysqli = new mysqli("localhost", "root", "", "learningbydoing");
$result = mysqli_query($mysqli, "SELECT * FROM question");
while($record = mysqli_fetch_array($result)){
echo '
';
}
?>
In this code snippet, we first fetch all the recordsets and store them in the `recordsets` variable. We then define a `currentIndex` variable to keep track of the current recordset being displayed.
The `showNextRecordset` function hides the current recordset and shows the next one. The `startCountdownTimer` function starts a countdown timer for the current recordset and moves to the next recordset when the timer reaches '0'.
Finally, we display the first recordset and start the countdown timer for it. The subsequent recordsets will be displayed one by one with the specified interval time.
Rate this post
4 of 5 based on 2765 votesComments