I'm attempting to build an array from multiple records (unknown how many records there could be at any one time) using a while loop and array_fill but it's not working the way I had hoped it would. It's overwriting the array with each record and then the only data in the array after the while loop finishes execution, is the last record loaded.
$reward is the variable being overwritten. Driving me nuts! I would like to see it build $reward into a merged array consisting of the (in this instance) 3 records that I'm querying for. But it's ending up being the last record found. What am I doing wrong?
while ($WhileLoop <= $PrizeCount) {
print "<!-- Loop # [" . $WhileLoop . "] -->\n";
$Prize1Credits = $PrizeRecord["Prize_Credits"];
$print "<!-- Cred # [" . $Prize1Credits . "] -->\n";
$Prize1ID = $PrizeRecord["Prize_ID"];
print "<!-- ID # [" . $Prize1ID . "] -->\n";
$reward = array_fill($ArrayIndex,$Prize1Credits,$Prize1ID);
print "<!-- IND # [" . $ArrayIndex . "] -->\n";
$ArrayIndex += $Prize1Credits;
$WhileLoop++;
$DBConnection->next_record();
$PrizeRecord = $DBConnection->Record;
}