Re: a lil problem with graffs....... problem caught solution required plz
| From: | toby z | Date: | Wed, 07 May 2003 11:36:45 +0000 |
| Subject: | Re: a lil problem with graffs....... problem caught solution required plz | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-19797@lists.php.net to get a copy of this message | ||
well i guess i was a bit too blind to have not seen the solution
a little
$gfData = "";
between the two calls to rprt_grf.php page did it all
thnx a mill anyways guyz
pretty :)
toby .....
--- toby z <blue_myth_1@yahoo.com> wrote: > k guyz heres the problem
>
>
>
>
> heres the code
>
> for($loop_mon=$frm_mon; $loop_mon<=$to_mon ; $loop_mon++){
>
>
> $ftch_dta_rprt_1_qry = "select count(date) from tbl_vill_398
> where month(date) = $loop_mon
> and year(date)=$yr";
>
> $ftch_dta_rprt_1_qry_rzlt_hndlr = mysql_query($ftch_dta_rprt_1_qry)
> or die();
>
>
> $ttl_rkz_ftchd = mysql_num_rows($ftch_dta_rprt_1_qry_rzlt_hndlr);
>
>
> $ftch_rprt_data = mysql_fetch_row($ftch_dta_rprt_1_qry_rzlt_hndlr);
>
> $rprt_data= $ftch_rprt_data[0];
>
> $gfData[] = $rprt_data;
>
>
>
>
> include"ftch_mon_nmz.php";
>
>
> $rprt_dt_arr = $rprt_dt_arr.",".$rprt_data;
>
> }
> include "rprt_gf.php";
>
>
> //repeat all this procedure for query 2 ! ! ! !
>
> for($loop_mon_=$frm_mon; $loop_mon_<=$to_mon ; $loop_mon_++){
>
>
> $ftch_dta_rprt_2_qry = "select count(date) from tbl_vill_398
> where month(date) = $loop_mon_
> and year(date)=$yr ";
> $ftch_dta_rprt_2_qry_rzlt_hndlr =
> mysql_query($ftch_dta_rprt_2_qry)
> or die("qry $ftch_dta_rprt_1_qry failed ! <br> da tbl must xixt in
> da db 2 b played vid ! ! ! !<br>".mysql_error());
>
>
>
> $ttl_rkz_ftchd_2 =
> mysql_num_rows($ftch_dta_rprt_2_qry_rzlt_hndlr);
>
>
> $ftch_rprt_data_2 =
> mysql_fetch_row($ftch_dta_rprt_2_qry_rzlt_hndlr);
> $rprt_data_2= $ftch_rprt_data_2[0];
>
> $gfData[] = $rprt_data_2;
>
>
>
>
> include"ftch_mon_nmz.php";
>
> $rprt_dt_arr_2 = $rprt_dt_arr_2.",".$rprt_data_2;
>
> }
> include "rprt_gf.php";
>
>
> ----------------------------------
> rprt_gf.php
> ----------------------------------
>
>
>
> for ($i = 0; $i < $max_data; $i++)
> {
> if ($arrData[$i] > $max_value)
> $max_value = $arrData[$i];
>
> if ( strlen($label[$i]) > $max_label_width )
> $max_label_width = strlen($label[$i]);
>
> $table_text = $table_text . "<th>" . $label[$i] . "</th>";
> }
>
> $table_text = $table_text . "</tr>";
>
> //$x = $max_label_width * $font_width + 10;
> $height = ($max_data * ($bar_width + $bar_gap)) - 10;
> $width = $max_value + $x + 150 ;
>
> $bar_x = $max_label_width * $font_width + $x + 5;
>
> $im = ImageCreate($width, $height);
> // Allocate colors
> $white = ImageColorAllocate($im, 255, 255, 255);
> $yellow = ImageColorAllocate($im, 240, 240, 70);
> $blue = ImageColorAllocate($im, 0, 64, 128);
> $bar = ImageColorAllocate($im, 64, 100, 168);
> $light_grey = ImageColorAllocate($im, 192, 192, 192);
> $black = ImageColorAllocate($im, 0, 0, 0);
>
> $lightest_grey = ImageColorAllocate($im, 210, 210, 210);
>
> // Background
> ImageFilledRectangle($im, 0, 0, $width, $height,$lightest_grey);
> //imagerectangle($im, 0, 0, $width, $height, $black);
> // Title
> //ImageString($im, 3, $title_x, 0, $title, $white);
>
> $table_text = $table_text . "<tr>";
>
> for ($i = 0; $i < $max_data; $i++)
> {
> ImageString(
> $im, 3, $x, $y + ($i * $bar_gap) ,
> $label[$i], $black
> );
> $px = $x + 100 + $arrData[$i];
>
> // Draw rectangle value
> imagefilledrectangle( $im,
> $bar_x,
> $y + ($i * $bar_gap),
> $px,
> $y + ($i * $bar_gap) + $bar_width ,
> $black);
>
> ImageString(
> $im, 3, $bar_x, $y + ($i * $bar_gap)+ $bar_width ,
> "(".$gfData[$i] . ")", $black
> );
>
> $table_text = $table_text . "<td style= \"font-family: $font\" >"
> .
> $gfData[$i] . "</td>";
> }
> $table_text = $table_text . "</tr></table></td></tr>";
>
> if($max_data>1){
>
> ImageJpeg($im, $tz);// Png($im);
>
> // Release allocated resources
> ImageDestroy($im);
> }
>
> echo($table_text);
> -----------------------------------------------------------------
>
>
> the problem :
> $gfData[]
> its being sent to the rprt_grf.php file twice
> i think i have to empty the array before i fill it again
> but how the devil do i do that
>
> or am i wrong here
>
> can n will someone plz help
> eternally thankfull
>
> toby.....
>
>
>
>
>
> --- toby z <blue_myth_1@yahoo.com> wrote: > hi guyz
> >
> > just a pessky little problem
> >
> >
> > ----------------------------------
> > ImageJpeg($im, $tz);// Png($im);
> >
> > // Release allocated resources
> > ImageDestroy($im);
> > ----------------------------------
> >
> > this dammed piece of code aint seem to be working
> > it creates a graph all well
> > but im sure it aint destroying it
> >
> > as im creating two graphs on a page
> > and the second graph appears as a copy of the first
> > onlt the first shows records for jan, feb and march
> > the second otta show records for the same months
> > it shows jan, feb, march records of the 1st graph
> > and then thee records for april
> > and these are the values it otta show for jan, feb and march
> >
> > i no i sound lost
> > as i very much am
> >
> > what m i to do with this
> > ImageDestroy($im);
> > thinggy ?????
> >
> >
> > thnx a mill
> > lost
> > toby .....
> >
> >
> > __________________________________________________
> > Yahoo! Plus
> > For a better Internet experience
> > http://www.yahoo.co.uk/btoffer
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
> __________________________________________________
> Yahoo! Plus
> For a better Internet experience
> http://www.yahoo.co.uk/btoffer
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
__________________________________________________
Yahoo! Plus
For a better Internet experience
http://www.yahoo.co.uk/btoffer