Good view snapCount!
The problem is this line
PHP Code:
while ($row_rt = $tot_rec)
As this will always be true (you can always assign $tot_rec to $row_rt), it will not get out of the while , and timeout here.
Would this rather be what you wanted to do?
PHP Code:
<?php
$biz_val= $row_c['business_id'];
$sql_rat="select * from tblrating where biz_id = $biz_val";
$result_rat = mysql_query($sql_rat);
$tot_rec = mysql_fetch_array($result_rat);
$i=$j=$d=0;
if($tot_rec>0){
$row_rt = $tot_rec;
while ($i<10){ //you set the condition here
$i++;
$j= $row_rt['rat_num'] + j;
}
$d=$j/$i; Problem is here.....
if ($d<=1.50){
echo "<img src=\"rat1.gif\">"
}
if ($d<=2.50 && $d>=1.51){
echo "<img src=\"rat2.gif\">"
}
}
This is probably a confusion upon loops.
You have 3 types of loop (that I think of) at disposal.
For, while and "do while" loops.
The for loop is well known, and the most current.
You define the counter, the max value and the steps to reach the max value in it's declaration:
PHP Code:
for($cpt=0;$cpt<10;$cpt++){
//...
}
whih means: loop with $cpt from 0 to 9.
Once the condition "$cpt<10" is false, the loop is exited.
In a for loop, the body is executed before the check of the condition.
The while loop is different in the sense that the condition is checked before the logic:
PHP Code:
$cpt=0;
while($cpt<10){
//..do stuff
$cpt++;
}
And the 3rd loop is a mix of both, "do while":
PHP Code:
$cpt=0;
do{
//..stuff here...
$cpt++;
}(while $cpt<10);
Here too, the condition is checked after the body have been executed.
The 3 loops here are doing the same, thing.
It's up to you to choose which one should be used in which case.
http://www.php.net/manual/en/control...ures.while.php
http://www.php.net/manual/en/control...s.do.while.php
http://www.php.net/manual/en/control-structures.for.php