Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.