Using PHP3,,,,,,
I have a multi-dim array that is 4 layers deep, using counters; i, j, k, q, l etc... I count the values retrieved from the table & use the count as a limit when building the array..
I pull variables out of a table & start the first level as follows;
for ($i=0; $i<$count; $i++) {
$cx[$i] = $row ["tab_val"];
$var_list2[$i] = $cx[$i];
$var_list2[$cx[$i]] = array("");
}
The second level is acquired in the same manner nesting the counters,
$var_list2[$var_list2[$j]][$k] = $gx[$k];
The third level is where I run into problems, the "$j" value does not appear to increment in the array (it does inc in the script). I end with the same value in position "0" or "1" or "n" for all values of $J.
$var_list2[$var_list2[$var_list2[$j]][$k]][$q] = $px[$q];
echo "Type[$j][$k][$q] is : " .$var_list2[$var_list2[$var_list2[$j]][$k]][$q]. "<br>";
The echo statement produces debug feedback that shows the array position that the value is inserted into is done correctly (as follows).
"Type[0][3][0] is : Halogen"
& when $j is "1" the echo produces;
"Type[1][3][0] is : Led"
If I force a read from the array using;
echo " Type 0,3,0, is :" .$var_list2[$var_list2[$var_list2["0"]]["3"]]["0"]. "<BR>";
or
echo " Type 1,3,0, is :" .$var_list2[$var_list2[$var_list2["1"]]["3"]]["0"]. "<BR>";
They both produce:
"Type[1][3][0] is : Led"
Which indicates no $j increment in the array OR the array position is the same!!!.
I have checked the loops & the logic by echoing the counter values. It all appears correct. I did not detect the problem until I did the forced echo.
Any ideas?