Link to home
Start Free TrialLog in
Avatar of Chris Stormer
Chris Stormer

asked on

Timing on a loop..

$result = mysql_query($query);
echo mysql_error();
 while($row = mysql_fetch_array($result)){
        $search = $row[0];
        echo $search;

I have this.  The final result will be different but I will be able to illustrate my question.   I want to loop the results one by one, one every 15 second and then the next row.  What would be the best way to do this?  For the end result I'll strictly be doing stuff that doesn't display on the screen but I'm not sure what the consequences are of running a loop with potentially thousands of records in a database.

.. Is it even possible to add timing to a php while loop..
Avatar of Cornelia Yoder
Cornelia Yoder
Flag of United States of America image

$result = mysql_query($query);
echo mysql_error();
 while($row = mysql_fetch_array($result)){
        $search = $row[0];
        echo $search;
        sleep(15);
}
Avatar of Chris Stormer
Chris Stormer

ASKER

This does work, when it's finish with the whole query it displays.

What are the concequences of running this against a few thousand records?
ASKER CERTIFIED SOLUTION
Avatar of Cornelia Yoder
Cornelia Yoder
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial