eva21 Posted November 6, 2008 Share Posted November 6, 2008 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!! Quote Link to comment https://forums.phpfreaks.com/topic/131653-not-sure-whats-wrong-but-im-trying-to-display-a-pie-chart/ Share on other sites More sharing options...
bobbinsbro Posted November 6, 2008 Share Posted November 6, 2008 i don't know if this is it, but i read in the comments in the php.net manual (in the ob_flush() section i think) that the buffer doesn't seem to catch php image functions. Quote Link to comment https://forums.phpfreaks.com/topic/131653-not-sure-whats-wrong-but-im-trying-to-display-a-pie-chart/#findComment-683826 Share on other sites More sharing options...
eva21 Posted November 6, 2008 Author Share Posted November 6, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/131653-not-sure-whats-wrong-but-im-trying-to-display-a-pie-chart/#findComment-683838 Share on other sites More sharing options...
bobbinsbro Posted November 6, 2008 Share Posted November 6, 2008 did you try omitting the ob functions (or is that what you just said you tried? ) Quote Link to comment https://forums.phpfreaks.com/topic/131653-not-sure-whats-wrong-but-im-trying-to-display-a-pie-chart/#findComment-683846 Share on other sites More sharing options...
Imad Posted November 6, 2008 Share Posted November 6, 2008 Did you make sure the file is properly encoded? Quote Link to comment https://forums.phpfreaks.com/topic/131653-not-sure-whats-wrong-but-im-trying-to-display-a-pie-chart/#findComment-683848 Share on other sites More sharing options...
eva21 Posted November 6, 2008 Author Share Posted November 6, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/131653-not-sure-whats-wrong-but-im-trying-to-display-a-pie-chart/#findComment-683852 Share on other sites More sharing options...
eva21 Posted November 6, 2008 Author Share Posted November 6, 2008 What do you mean? This isnt going to a file but i just want to display the pie chart to the user. Quote Link to comment https://forums.phpfreaks.com/topic/131653-not-sure-whats-wrong-but-im-trying-to-display-a-pie-chart/#findComment-683854 Share on other sites More sharing options...
bobbinsbro Posted November 6, 2008 Share Posted November 6, 2008 i know virtually nothing about headers, but won't the page be unhappy if you state it contains a png image and you output html into it? Quote Link to comment https://forums.phpfreaks.com/topic/131653-not-sure-whats-wrong-but-im-trying-to-display-a-pie-chart/#findComment-683856 Share on other sites More sharing options...
Imad Posted November 6, 2008 Share Posted November 6, 2008 Try adding this after the opening php tag: error_reporting(E_ALL); and post the output Quote Link to comment https://forums.phpfreaks.com/topic/131653-not-sure-whats-wrong-but-im-trying-to-display-a-pie-chart/#findComment-683858 Share on other sites More sharing options...
eva21 Posted November 6, 2008 Author Share Posted November 6, 2008 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`‚ Quote Link to comment https://forums.phpfreaks.com/topic/131653-not-sure-whats-wrong-but-im-trying-to-display-a-pie-chart/#findComment-683865 Share on other sites More sharing options...
Imad Posted November 6, 2008 Share Posted November 6, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/131653-not-sure-whats-wrong-but-im-trying-to-display-a-pie-chart/#findComment-683868 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.