Forum Moderators: coopster
$i =1;
while($i<=54){
$qry = "select sub$i from table";
$result = mysql_query($result);
while($row = mysql_fetch_object($result)){
$sub = $row -> sub$i;//line 6
if($sub!=0){
.
.
}
}//end of inner while
$i++;
}//end of outer while
But I always get an error message on line 6 saying unexpected T_VARIABLE.
Can't I use variable $i as an index for sub in that line? I want to coculate the average for each column excluding the field of '0'. Any suggestions to efficiently extract data from such a table?
Thanks in advance.
It is very tedious. I am wondering if I can use a while or for loop here, it'll save a lot pain. Do you know there is any way I can use a loop here?
Thanks again.