Jump to content

Not sure whats wrong, but im trying to display a pie chart


Recommended Posts

I have this at the top of my file, because before i was getting header errors.

 

<?php

ob_start();

header('Content-type: image/png');

include "php_piechart.php";

?>

<html>

 

And this at the bottom...

</html>

<?php

ob_flush(); ?>

 

Now when im trying to call the pie chart function to display it like this...

createPieChart($value1, $value2, $value3);

 

But in my form, this is what i get...

‰PNG IHDRÈÈš†^¬KPLTEâââÿËÜe½3Öb`>ˆf³‘Ãsj²Ò4‰[JR8/Í™ª3‹¤M0. V4_‘A8€ W) ! ƒ€IDATxœíÑÛ¶‚0 „aÝ^×÷Ü- ÒJ’LÉšÿž0ßêíÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1¥þКú+ =s¿BÀÐ FÃPšnÃAN£‚°Æ¨"ì0& uŠ™BÕb¬P²@â BÒ‚VÌ9aL9aLùP,yq´HЋwó⨓ ·žäÅQ,AÏ,È cÊ‹ãL‚^W•Ç=¬:/Ž zTS^9 zQc^ zNG^‰=¥3ôî¼AÐ3òy\Ûñˆº"ä‘ë:ìü‚^xØÉüD‚Þš«|ÿ†ù#Aºæã!Bóañý¶Ç]? ˆÃbÂЇ1´!f ]ˆ!Cbʘ OŒ—CbÍP‚Ø3ˆ°Á¸‡ 0>9 ˆñrˆBPŒ""Á1&‡Èˆ!½(cv„›€Ëø:H‡dGi•€oÇ éy4#~Ž'A#î郴JІ©ÔñTIЄ¹ð©— KÇR(AÞ…-d•PÐûß…œ£B‚ÞÿiÇKŽ(èùŸÂ®£H‚žÿíÈCòôúµpI$[ züZ8qJÐã£Î?’çøŒ=ÇŽ½=®Ðñ+™,èéQ!;2ôúouŒŒd Ê/ãÜ1$¥‰‘“@-E±#+Y2Š GŽ2_AQÅØHÖ3`Eµ#¡¤—.ÆX%¹{D«c±ìµF´+æŽ.ËjNþÔÇ( HhÎÑÏ(£´kŠnË0Ê-5 òƒ‚ŠZËÆÖþ©¸¢×2’ÂØ¢ª°£è3 0VUŒ5BC3¬y0¬y0$]pÐ5W3ÆcŒ1ÆcŒ1ÆcŒ1Æc›þ Ê鱕ñIEND®B`‚

 

..Weird eh...now i have this pie chart before it im trying to put it in a table in html does that matter? Im not sure why its not working with this file, because by itself it works just fine. Please help!!

I took those out, didnt make a difference. Still giving me the strange output instead of the pie chart. Ive been reading it and it says that you cant have any ending tags or white space...i dont seem to have any so im not sure what the heck is going on. Like if i put the code (the make a pie chart function) in another file by itself and run it, i get the pie chart. Not sure whats going on, help would be EXTREMELY appreciated.

I had the ob functions to begin with, now they are taken out. So now its like this at the beginning:

<?php

include "php_piechart.php";

header('Content-type: image/png');

?>

 

Calling the function:

<div style="width: 2000px; margin: 20px auto; font-family:sans-serif;">

<table border="3" cellpadding="2" width="500">

<tr>

<td align="center">

<?php

$value1 = $_SESSION['percent1'];

$value2 = $_SESSION['percent2'];

$value3 = $_SESSION['percent3'];

//Making a image 200 x 200

createPieChart($value1, $value2, $value3);

 

But i still get that messy bit of code....it really sucks! Not sure what is going on.

This is what i get:

 

Notice: Undefined offset: 3 in C:\wamp\www\php_piechart.php on line 62

 

Notice: Undefined offset: 2 in C:\wamp\www\php_piechart.php on line 83

 

Notice: Undefined offset: 2 in C:\wamp\www\php_piechart.php on line 83

 

Notice: Undefined offset: 2 in C:\wamp\www\php_piechart.php on line 83

 

Notice: Undefined offset: 2 in C:\wamp\www\php_piechart.php on line 83

 

Notice: Undefined offset: 2 in C:\wamp\www\php_piechart.php on line 83

 

Notice: Undefined offset: 2 in C:\wamp\www\php_piechart.php on line 83

 

Notice: Undefined offset: 2 in C:\wamp\www\php_piechart.php on line 83

 

Notice: Undefined offset: 2 in C:\wamp\www\php_piechart.php on line 83

 

Notice: Undefined offset: 2 in C:\wamp\www\php_piechart.php on line 83

 

Notice: Undefined offset: 2 in C:\wamp\www\php_piechart.php on line 83

‰PNG IHDRÈÈš†^¬KPLTEâââÿËÜe½3Öb`>ˆf³‘Ãsj²Ò4‰[JR8/Í™ª3‹¤M0. V4_‘A8€ W) ! ƒ€IDATxœíÑÛ¶‚0 „aÝ^×÷Ü- ÒJ’LÉšÿž0ßêíÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1ÆcŒ1¥þКú+ =s¿BÀÐ FÃPšnÃAN£‚°Æ¨"ì0& uŠ™BÕb¬P²@â BÒ‚VÌ9aL9aLùP,yq´HЋwó⨓ ·žäÅQ,AÏ,È cÊ‹ãL‚^W•Ç=¬:/Ž zTS^9 zQc^ zNG^‰=¥3ôî¼AÐ3òy\Ûñˆº"ä‘ë:ìü‚^xØÉüD‚Þš«|ÿ†ù#Aºæã!Bóañý¶Ç]? ˆÃbÂЇ1´!f ]ˆ!Cbʘ OŒ—CbÍP‚Ø3ˆ°Á¸‡ 0>9 ˆñrˆBPŒ""Á1&‡Èˆ!½(cv„›€Ëø:H‡dGi•€oÇ éy4#~Ž'A#î郴JІ©ÔñTIЄ¹ð©— KÇR(AÞ…-d•PÐûß…œ£B‚ÞÿiÇKŽ(èùŸÂ®£H‚žÿíÈCòôúµpI$[ züZ8qJÐã£Î?’çøŒ=ÇŽ½=®Ðñ+™,èéQ!;2ôúouŒŒd Ê/ãÜ1$¥‰‘“@-E±#+Y2Š GŽ2_AQÅØHÖ3`Eµ#¡¤—.ÆX%¹{D«c±ìµF´+æŽ.ËjNþÔÇ( HhÎÑÏ(£´kŠnË0Ê-5 òƒ‚ŠZËÆÖþ©¸¢×2’ÂØ¢ª°£è3 0VUŒ5BC3¬y0¬y0$]pÐ5W3ÆcŒ1ÆcŒ1ÆcŒ1Æc›þ Ê鱕ñIEND®B`‚

Since I can't see what you have in pie_chart.php, try removing the html you have in the code you posted here, and view the output. As bobbinsbro said, it could be the html you added which is causing the main problem. Plus, notices shouldn't cause the error you're getting.

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.