How to delay data printing to screen from query within loop
Posted: Sun May 03, 2009 6:36 pm
Hello all - hope you can help me out here...
I want to be able to delay the output to screen of rows of data from a database. Here's a snippet. i use mysql_fetch_object(). That may/may not be the best way to ge the data and then display. What I want is to display it to screen one line at a time - with a delay of say 2 seconds at a time. Tried sleep() but didn't work. Any ideas?
Thanks
I want to be able to delay the output to screen of rows of data from a database. Here's a snippet. i use mysql_fetch_object(). That may/may not be the best way to ge the data and then display. What I want is to display it to screen one line at a time - with a delay of say 2 seconds at a time. Tried sleep() but didn't work. Any ideas?
Thanks
Code: Select all
for ($y = 0; $y < $rows; $y++) {
$data = @mysql_fetch_object($navresult);
echo"<tr align=\"left\" ><td width = \"46%\" align =\"left\" style =\"font-size:12px\">$data->name</td>";
echo"<td width = \"34%\" align =\"left\" style =\"font-size:12px\">$data->number</td>";
echo"<td width = \"10%\" align =\"left\" style =\"font-size:12px\">$data->category</td>";
echo"<td width=\"10%\" ><A title=\"Click here to edit this record\" onmouseover=\"window.status='click here to edit this record';return true;\" onclick=\"return true;\" onmouseout=\"window.status='';return true;\"href=\"edit.php?record=$data->record_id\"\"><span style=\"color:#50a7f0\">edit</span></A></td></tr>";
}
echo"</table><BR><BR>";