Hi all,
I've a progress bar code and another is the results of the query is being displayed in a table. How do i relate these two so that the progress of the progress bar is displayed as the table is displayed. I've a large table to be displayed with 1000+ rows with many fields.I've given the progress bar code and the table code.plz help.


Progress bar code.


Code:
if (ob_get_level() == 0) {
   ob_start();
}

echo str_pad('Loading... ',4096)."<br />\n";

for ($i = 0; $i < $num; $i++) {
   $d = $d + 11;
   $m=$d+10;
   //This div will show loading percents
   echo '<div class="percents">' . $i*4 . '%&nbsp;complete</div>';
   //This div will show progress bar
   echo '<div class="blocks" style="left: '.$d.'px">&nbsp;</div>';
   flush();
   ob_flush();
   sleep(1);
}
ob_end_flush();

table display code;

Code:
<?php
error_reporting(E_ALL); 
?>

<HTML>
<HEAD>

<style type="text/css"><!--

div {
 margin: 1px;
 height: 20px;
 padding: 1px;
 border: 1px solid #000;
 width: 275px;
 background: #fff;
 color: #000;
 float: left;
 clear: right;
 top: 38px;
 z-index: 9
}

.percents {
 background: #FFF;
 border: 1px solid #CCC;
 margin: 1px;
 height: 20px;
 position:absolute;
 width:275px;
 z-index:10;
 left: 10px;
 top: 38px;
 text-align: center;
}

.blocks {
 background: #EEE;
 border: 1px solid #CCC;
 margin: 1px;
 height: 20px;
 width: 10px;
 position: absolute;
 z-index:11;
 left: 12px;
 top: 38px;
 filter: alpha(opacity=50);
 -moz-opacity: 0.5;
 opacity: 0.5;
 -khtml-opacity: .5
}

-->
</style>
</head>
</HEAD>
<BODY background=images/ltgray_lines1.gif text=ffffff link=ffffff vlink=ff0000> 
<?php

$streamtype=$_REQUEST[streamtype];
$streamname=$_REQUEST[streamname];
$profile=$_REQUEST[profile];
$resolution1=$_REQUEST[resolution1];
$resolution2=$_REQUEST[resolution2];
$clockrate=$_REQUEST[clockrate];
$videopid=$_REQUEST[videopid];
//echo "the value of videopid is $videopid";
$pcrpid=$_REQUEST[pcrpid];
$audiopid=$_REQUEST[audiopid];
$videotype=$_REQUEST[videotype];
$audiotype=$_REQUEST[audiotype];
$ac3bitrate=$_REQUEST[ac3bitrate];
$ac3mod=$_REQUEST[ac3mod];
$samplerate=$_REQUEST[samplerate];
$query= $_REQUEST[query];
//echo "-------- $query-------";
$query1= $_REQUEST[query1];
//echo "-------- $query1-------";

$query2="where ";

if($query1=="all" ) {
    $query1="streamtype,streamname,resolution,clockrate,videopid,videotype,pcrpid,audiopid,audiotype,samplerate,ac3mod,ac3bitrate";
}

$query1=str_replace("streamtype","streamid",$query1);

if (isset($streamid) ) {
$query2=sprintf("%s streamid='%s' and",$query2, $streamtype);
}

if (isset($streamname) ) {
	if ($streamname == "" ) $temp="%";
	else {
		$temp=str_replace(" ","%",$streamname);
		$temp=str_replace("*","%",$temp);
	}
$query2=sprintf("%s streamname like '%s' and",$query2, $temp);
}

if ( isset($profile) ) {
	if ($profile != "")  $query2=sprintf("%s profile='%s'  and",$query2,  $profile);
	else  $query2=sprintf("%s profile like '%s'  and",$query2,"%");
}


if (isset($resolution1) ) {
$temp1=str_replace(" ","%",$resolution1);
$temp2=str_replace(" ","%",$resolution2);
$query2=sprintf("%s resolution like '%s%sx%s%s' and",$query2, "%", $temp1, $temp2, "%");

}

if (isset($clockrate) ) {
$temp=str_replace(" ","",$clockrate);
$temp=str_replace("*","",$temp);
if ($temp!="" ) 
   $query2="$query2 round(clockrate)=round($temp) and";
} 

if (isset($videopid) ) {
$temp=str_replace(" ","%",$videopid);
$temp=str_replace("*","%",$temp);
$query2=sprintf("%s videopid like '%s%s%s' and",$query2, "%", $temp, "%");
//echo "---------$query2---------------";
}

if (isset($pcrpid) ) {
$temp=str_replace(" ","%",$pcrpid);
$temp=str_replace("*","%",$temp);
$query2=sprintf("%s pcrpid like '%s%s%s' and",$query2, "%", $temp, "%");
}

if (isset($audiopid) ) {
$temp=str_replace(" ","%",$audiopid);
$temp=str_replace("*","%",$temp);
echo "the value of temp is $temp";
$query2=sprintf("%s audiopid like '%s%s%s' and",$query2, "%", $temp, "%");
}

if (isset($videotype) ) {
$temp=str_replace(" ","",$videotype);$temp=str_replace("*","%",$temp);
$query2=sprintf("%s videotype like '%s%s%s' and",$query2, "%", $temp, "%");
}

if (isset($audiotype) ) {
$temp=str_replace(" ","",$audiotype);$temp=str_replace("*","%",$temp);
$query2=sprintf("%s audiotype like '%s%s%s' and",$query2, "%", $temp, "%");
}

if (isset($ac3bitrate) ) {
$temp=str_replace(" ","",$ac3bitrate);$temp=str_replace("*","%",$temp);
$query2=sprintf("%s ac3bitrate like '%s%s%s' and",$query2, "%", $temp, "%");
}

if (isset($ac3mod) ) {
$temp=str_replace(" ","",$ac3mod);$temp=str_replace("*","%",$temp);
$query2=sprintf("%s ac3mod like '%s%s%s' and",$query2, "%", $temp, "%");
}

if (isset($samplerate) ) {
$temp=str_replace(" ","",$samplerate);$temp=str_replace("*","%",$temp);
$query2=sprintf("%s samplerate like '%s%s%s' and",$query2, "%", $temp, "%");
}




$query2=substr($query2,0,strlen($query2)-3);

$query=sprintf("SELECT * from streams %s order by streamname",$query2);

$db = mysql_connect("localhost", "root", "ramki");
mysql_select_db("streamware",$db);
$username = "root";
$password = "ramki";
$db_name = "streamware";
$hostname = "localhost";
$connection  = mysql_connect("$hostname", "$username", "$password")
            or die("Invalid Login:".mysql_error());



$db = @mysql_select_db($db_name) or die("Unable to select database:".mysql_error());
$result = mysql_query($query, $connection);


if($result==0)
{
	echo "<font color=black><center><h3>Please Check: Your inputs are INVALID</h3></center></font>";
	exit;
}

$num=mysql_numrows($result);


if ($num==0)
{
	echo"<font color=black><center><h3>No Results Found</h3></center></font>";
	exit;
}

if(strlen($query1)<=0)
{
	echo "<font color=black><center><h3>No Field Selected</h3></center></font>";
	exit;
}
echo "<font color=black><center><h4><b>Total Records Found:$num</b></h4></center></font>";
mysql_close();

$ifields=split(",",$query1);

$i=0;
$bgc="black";
echo "<center><font size=9 face=\"book antiqua\"><table cellspacing=1 border=3><tr bgcolor=000000><th>Sl #</th>";
echo "<th>StreamId</th>";
echo "<th>Directory Path</th>";
echo "<th>Name</th>";
echo "<th>For Details</th>";

foreach($ifields as $field)
{
	if ($field=="typeid")
	{
	}
	else 
	{ 
		if ($field=="streamname") 
		{
		}
		else 
		{
		echo "<th>$field</th>";
		}
	}	
}

while ($i<=$num-1) 
{
	$type=mysql_result($result,$i,"streamid");
	$directory=mysql_result($result,$i,"directoryid");
	//$type=mysql_result($result,$i,"typeid");
	$streamname=mysql_result($result,$i,"streamname");
	$streampath=mysql_result($result,$i,"streampath");        

	$querytype = "SELECT * from type where id=$type";
	$resulttype = mysql_query($querytype, $connection);
	$typename=mysql_result($resulttype,0,"name");

	//$dirname = "SELECT * from directory where id=$directory and typeid=$type";
	//$resulttype = mysql_query($dirname, $connection);
	//$directoryname=mysql_result($resulttype,0,"name");

	echo "<tr bgcolor=$bgc><td>$i</td>";
	echo "<td>$type</td>";
	echo "<td>$streampath</td>";
	echo "<td>$streamname</td>";
	echo "<td><a href=\"details.php?type=$type&directory=$streampath&name=$streamname\" target=main>Click Here </a></td>";

	foreach($ifields as $field)
	{
		if ($field=="type"  || $field=="streamname" ) 
		{
		  // Do Nothing.
		} 
		else 
		{

			$value=mysql_result($result,$i,$field);
			$Hex="";
			if ( $field=="pcrpid" || $field=="audiopid" || $field=="videopid" ) 
			{
				if ( hexdec($value) !=0 ) $Hex="0x";
			} 
			else if ( $field=="ac3bitrate" || $field=="samplerate" ) 
			{
				if ( $value="0.000000") $value="";
			}

			echo "<td>$Hex$value</td>";
		}
	}
	$next=$i+1;
	if ($i%2==0)
	{
 		$bgc="gray";
	}
	else
	{
 		$bgc="black";
	}
	$i++;
}
echo"</table></font></center>";

?>
</BODY>
</HTML>