Sorry, don't understand.
This is a dump of my table after running example:
ID | NUSER | R.NAME | NWEEK | VALUE
1 | 0 | pil0 | 0 | 0
2 | 0 | pil0 | 1 | 8
3 | 0 | pil0 | 2 | 16
4 | 0 | pil0 | 3 | 24
5 | 0 | pil0 | 4 | 32
6 | 0 | pil0 | 5 | 40
7 | 0 | pil0 | 6 | 48
8 | 0 | pil0 | 7 | 56
9 | 1 | pil1 | 0 | 1
10 | 1 | pil1 | 1 | 9
11 | 1 | pil1 | 2 | 17
...
Every person have more than one occurence.
Check these lines:
for ($i = 0; $i < sizeof($distribution); $i++)
for ($j = 0; $j < sizeof($distribution[$i]); $j++) {
there isn't a ";" after first for...
If you want all occurrence in one row change DB:
ID as integer, (autoinc, primary key etc..)
NUSER as integer,
REALNAME as char[255],
VALUE as char[255].
And inner loop:
for ($i = 0; $i < sizeof($distribution); $i++)
{
$values="";
for ($j = 0; $j < sizeof($distribution[$i]); $j++)
{
$values.=$distribution[$i][$j].";";
}
$myquery="INSERT INTO distributor VALUES(0, '".$i."','".$persons[$i]."','".$values)";
// to debug echo $myquery
mysql_query($myquery) or die ("Error: ".mysql_error());
}