I have a group of values ββand I need specific output:
i in the table these values:
id | value 1 | 1/4 2 | 5/1 3 | 4/1 4 | 6/1 5 | 2/1 6 | 3/1
What am I trying to do:
A | B | C | D | A | 1 | 1/4 | 5/1 | 4/1 | B | | 1 | 6/1 | 2/1 | C | | | 1 | 3/1 | D | | | | 1 |
I have only 6 values, and I am making an output with 10 values
:
$matrix[0][0] = 1/1; $matrix[0][1] = 1/4; $matrix[0][2] = 5/1; $matrix[0][3] = 4/1; $matrix[1][1] = 1/1; $matrix[1][2] = 6/1; $matrix[1][3] = 2/1; $matrix[2][2] = 1/1; $matrix[2][3] = 3/1; $matrix[3][3] = 1/1;
I am trying to do something like this, but without success:
while ($sql -> fetch()) { for ($i = 0; $i < (//something); $i++) { for ($x = 0; $x < (//something); $x++) { $matrix[$i][$i+1] = $result; } } }
any idea? thanks
source share