I need to find out how I can create variables dynamically based on the number of records returned in a MySQL query. I am trying to build a JpGraph gantt chart with fetched data.
This is what a hardcoded sample looks like:
$activity1 = new GanttBar (1,"Create a filter system for the goals page", "2004-01-28", "2004-02-23","[5%]");
$activity2 = new GanttBar (2,"Design the Accomplishments portion of the system", "2004-02-10", "2004-03-06","[2%]");
$activity3 = new GanttBar (3,"Take 2 more Pragmatech courses", "2004-02-12", "2004-04-01","[1%]");
I need to dynamically create the $activity1, $activity2, $activity3, etc... Here's what I was attempting:
$i = 1;
while ($row = $result->FetchNextObject()) {
"\$activity" . $i = new GanttBar ($i, $row->STATED_GOAL, $row->DATE_CREATED, $row->DATE_DUE, $row->PERCENTAGE);
$i++;
}
Thanks,
--zbert