Hi, I am sure that somebody must have come across this problem before, but I have been looking all over for a solution!
Scenario....
I have a database with 11 fields, which are all called the same, except with a different number at the end, ie Player_1, Player_2..... Player_11
I have retrieved the "value" from the database using the following : $row = mysql_fetch_assoc($result), and then extract($row) to give me each "Field" as a variable... ie $Player_1, $Player_2, etc.....
All 11 fields may not be filled in, so I also have $Players, which has how many "Players" there are.
Problem....
I want to display the values of each $Player_x using a while loop.
$row = mysql_fetch_assoc($result); // Gets the data from database.
extract($row); // Breaks array down to individual variables.
$i=1; // Set Up a counter
while ($i<=$Players) {
$a= 'Player_'.$i; // $a becomes $Player_1 then next time $Player_2 etc...
echo $a; // Display it!
$a++ //increment $i and run again!
}
This works fine, appart from I can not get the value from the Initial Player_1 variable to display...
I hope this makes sense!
Thanks for any help!