I am wanting to create a list that reveals itself slowly on the screen, but it seems that all routines are completed before they present themselves.
For example:
for ($x = 0; $x <= 25; $x++)
{
echo "The number is: $x <br>";
sleep(1);
}
In my mind this should display "The number is 1", wait 1 second then display "The number is 2". In reality is waits 25 seconds and shows all the numbers, except there seems to be an error there too as it only actually displays the first 10 !!!
EDIT: I also tried "usleep" which had the same effect
I'm not concerned with the error, but how do I add some waiting please?
EDIT: Following on, I am still getting the same issue with this code.
for ($x = 1; $x < 5; $x++)
{
$st=$_SESSION['st']=$x;
echo '<iframe class="findlist" name="iframefindlist" id="findlist" src="findmelist.php"></iframe>';
ob_flush();
flush();
usleep(3000000);
}
And then the "findmelist.php" is
<body>
<?php
$st=$_SESSION['st'];
$conn = new mysqli("localhost", "acc", "pw", "db");
?>
<div class="findlist1">
</div>
<div class="findlist2">
<?php
$result = mysqli_query($conn,"SELECT * FROM tablename WHERE number='$st'");
while($row = mysqli_fetch_array($result))
{
$fname=$row['fname'];
$lname=$row['lname'];
}
echo $fname.' '.$lname;
?>
</div>
<div class="findlist3">
</div>
</body>