Help with array
| From: | John Thorne | Date: | Sun, 16 Feb 2003 12:22:13 +0000 |
| Subject: | Help with array | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-25662@lists.php.net to get a copy of this message | ||
Hello
Working with jpGraph Gnatt Graph
Sample gnatt files shows data array as follows:
$data = array(
array(0,"Concept","2002-9-1","2002-9-15",blue),
array(1,"Creative","2002-9-15","2002-9-30",red),
array(2,"Produce","2002-9-31","2002-10-10",green)):
Output $data looks like this:
0: 0
1: Concept
2: 2002-9-1
3: 2002-9-15
4: blue
0: 1
1: Creative
2: 2002-9-15
3: 2002-9-30
4: red
0: 2
1: Produce
2: 2002-9-31
3: 2002-10-10
4: green
I want to create this $data array thru mySQL sql
The routine I have used on other graphs:
$query = "order, task ,DATE_FORMAT(start, '%Y-%m-%d'),DATE_FORMAT(end,
'%Y-%m-%d'), color
FROM timeline WHERE jobnu = 8648
$result = mysql_query ($query);
$cpt=0;
while($row = mysql_fetch_row($result))
{
$data[$cpt]=
$row[0].",".$row[1].",".$row[2].",".$row[3].",".$row[4];
$cpt++;
}
Output $data
0,Concept,2002-9-1,2002-9-15,blue
1,Creative,2002-9-15,2002-9-30,red
2,Produce,2002-9-31,2002-10-10,green
etc....
How can I create the array (in an array ??) show in the sample
$data thru my SQL query ??
thanks
jrt