Jump to content

JPGraph help with Array


_spaz

Recommended Posts

Hey guys, how do I use JPGRAPH's to graph the below array results? (Weeks on the X axis and sum results in different colored bars / week for the y-axis.  I have no idea how to do this, any help would be appreciated!!

 

$queryatl="SELECT WEEK(Arrival) as Week,

SUM(DATEDIFF(Release,Arrival) < 0) as Lessthan0,

SUM(DATEDIFF(Release,Arrival) =0) as 0day,

SUM(DATEDIFF(Release,Arrival) BETWEEN 1 and 5) as 1to5,

SUM(DATEDIFF(Release,Arrival) BETWEEN 6 and 10) as 6to10,

SUM(DATEDIFF(Release,Arrival) BETWEEN 11 and 15) as 11to15

FROM TableWHERE Arrival>= '2009-11-01' and Arrival <= '2009-11-30' GROUP BY WEEK(Arrival,0)";

 

$resultatl = mysql_query($queryatl) or die (mysql_error());

 

//$data2y=mysql_fetch_assoc($resultatl);

 

while ($row = mysql_fetch_assoc($resultatl)) {

print_r ($row);

}

..................

Results:

Array ( [Week] => 44 [Lessthan0] => 0 [0day] => 0 [1to5] => 0 [6to10] => 2 [11to15] => 5 )

Array ( [Week] => 45 [Lessthan0] => 0 [0day] => 0 [1to5] => 10 [6to10] => 11 [11to15] => 8 )

Array ( [Week] => 46 [Lessthan0] => 0 [0day] => 0 [1to5] => 1 [6to10] => 19 [11to15] => 5 )

Array ( [Week] => 47 [Lessthan0] => 2 [0day] => 0 [1to5] => 1 [6to10] => 2 [11to15] => 0 )

Array ( [Week] => 48 [Lessthan0] => 1 [0day] => 0 [1to5] => 1 [6to10] => 0 [11to15] => 0 )

Link to comment
https://forums.phpfreaks.com/topic/184419-jpgraph-help-with-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.