The below-provided code is used to fill an array "data".
$query1="SELECT * FROM tab1, tab2 WHERE tab1.column1=tab2.column2;";
$result1=DatabaseConnector::ExecuteQueryArray($query1);
$data = array();
$i = 0;
foreach ($result1 as $row):
$data[] = array(
array($i,array("xxx",' EE112',$row['column3'],'FT445'),"2004-03-01 10:00","2004-03-01 14:00"));
$i++;
endforeach;
When I try reading data from the array, the error "Undefined offset: 1" occurs. The funny thing is that when I filled "data" array using $data =
and not $data[] =
, there was no error, just the last row was filled. The error is produced by line $bar = new GanttBar(..)
. I tried to substitute $row['column3']
by some string "xxx", but there was the same error.
for($i=0; $i<count($data); ++$i) {
$bar = new GanttBar($data[$i][0],$data[$i][1],$data[$i][2],$data[$i][3]);
$graph->Add($bar);
}