I feel like this should be extremely simple, but I cannot for the life of me get it to cooperate. Part of one of my functions pulls data out of a database and build an array, but the index variable doesn't seem to be available within the while loop.
for($i = 0; $i < $numAlts; $i++)
{
while($row = $db->sql_fetchrow($result))
{
echo $i;
$tempArray[($row['name'].$i)] = array('name' => $row['name'].$i, 'value' => $row['value'], 'show' => $row['show'], 'required' => $row['required']);
}
array_push($array, $tempArray);
}
the echo was put in there to help me debug the thing. It should be echoing 123... but instead it echo's 00000000.
The nested loops work fine, exiting when they should, but every row has the same name eg Name0.
Is there some weird PHP variable scoping that I'm not aware of?