[SOLVED] Loop does not work....
Posted: Tue Apr 12, 2005 4:07 am
Hi dears... I have this code to check for a missing line from results from database, and i have a problem on the looping... infact it does not rendere all the rows, but only the first one...
Where do i miss something?
Thanks to all those who will help...
(this is only the last part of the code...)
Where do i miss something?
Thanks to all those who will help...
Code: Select all
if(mysql_num_rows($result))
{
//open table, if data exists.
echo "<table width=".$total." border='0'><tr><td width=".$width_transaction_name." bgcolor=".$bgcolor_head."><div align=".$alignment_head."><font color=".$font_color_head."><strong>TRANS. NAME</strong></font></div></td><td width=".$width_transaction_response_time." bgcolor=".$bgcolor_head."><div align=".$alignment_head."><font color=".$font_color_head."><strong>TRANS. RESPONSE TIME</strong></font></div></td><td width=".$width_execution_time." bgcolor=".$bgcolor_head."><div align=".$alignment_head."><font color=".$font_color_head."><strong>EXEC. TIME</strong></font></div></td></tr>";
//start the rendering of the results
$myrow = mysql_fetch_array($result);
//alternate color on results
$bgcolor = ($bgcolor=='#E5E5E5'? '#F3F3F3' : '#E5E5E5');
//define Variable for time handling
$timeHandling = str_replace(',','',$myrow['scenario_elapsed_time']);
//define hour
$hour = (int)($timeHandling / 3600 + ;
//define minutes
$v_mins = (int)($timeHandling / 900);
$mins = (($v_mins*15) % 60);
//Set variable to set up time increment
$timeMark = 0;
//render the result
while ($mins != $timeMark)
{
//Log all intervening times for which there is no event
echo "<tr><td width=".$width_transaction_name." bgcolor=".$bgcolor."><font color='red'><div align=center><strong>++++</font></div></strong></td><td width=".$width_transaction_response_time." bgcolor=".$bgcolor."><font color='red'><div align=center><strong>++++</font></div></strong></td><td width=".$width_execution_time." bgcolor=".$bgcolor."><font color='red'><div align=center><strong>SCRIPT ERROR</font></div></strong></td></tr>";
if (($timeMark += 15) > 45) $timeMark = 0;
}
//Log the next event
echo "<tr><td width=".$width_transaction_name." bgcolor=".$bgcolor.">".$myrow['transaction_name']."</td><td width=".$width_transaction_response_time." bgcolor=".$bgcolor.">".$myrow['transaction_response_time']."</td><td width=".$width_execution_time." bgcolor=".$bgcolor."><strong><font color=red>".$hour." : ".$mins."</strong></font></td></tr>";
if (($timeMark += 15) > 45) $timeMark = 0;
}
//at the end of the renderinig close the table
echo "</table>";