Hi,
I have a question - maybe someone can help me with. To explain my situation, I have a table with ten fields: week_1 through week_10.
I am trying to calculate the average of the integer data in these ten fields through a while loop. Here's that I have. $player
$load_player=mysql_query("SELECT * FROM player_data WHERE player_link='$player_ID'");
$player_array=mysql_fetch_array($load_player);
$sum=0;
$i=1;
while ($i<=10) {
$current_week="week_" . $i;
$current_score=$player_array['$current_week'];
$sum=$sum+$current_score;
$i++;
}
$new_avg=$sum / $avg_to;
After the PHP script runs - $sum always winds up to be zero - as it seems that $player_aray['$current_week']; is not accessing the field data properly.
Can anyone help me out of this jam? I know I could just write the code in ten separate lines, accessing each week by itself, but I'd like to apply this to tables that have upwards of 25-100 weeks in the future.
Much obliged,
Jeff