Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 22 Oct 2014, 08:50
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
linechart with php
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
teevee

Joined: 07 Apr 2009
Posts: 9
Location: Tampere / Finland

PostPosted: Tue 11 Jan 2011, 15:15    Post_subject:  linechart with php
Sub_title: usable variables
 

I have weird problem with php coding. I don't know if it's a Puppy/hiawatha/php related, or if it's just a lack of my knowledge...


I have html file with entry "<img src="pic_Kayrat.php" />"

I have some for loops in pic_Kayrat.php. If I run the page code without
Code:
header ("Content-type: image/png"); imagepng($im);

so, as a normal php page. Everything works fine.
If I run it as a image, it prints nothing.

I have code example:

Code:
for ($j = 1; $j < count($Aika); $j++) {  echo "what ever"; }

where $Aika is an array. In normal page code it echoes everything I want.
Code:
for ($j = 1; $j < count($Aika); $j++) {  imageline($im, 50, 100, 500, 100, $blue); }

$blue is handled earlier. This line does not show up.

If I use
Code:
for ($j = 1; $j < 15; $j++) {  imageline($im, 50, 100, 500, 100, $blue); }

where I replaced count($Aika) with number 15, line shows up in picture.

Does anybody have a glue what is happening in my code?
Why my variables are not valid?
Back to top
View user's profile Send_private_message 
teevee

Joined: 07 Apr 2009
Posts: 9
Location: Tampere / Finland

PostPosted: Wed 19 Jan 2011, 13:56    Post_subject:  

Now I have some kind of "solution" to this problem.

Everything is messed up by my mysql queries. If I do queries in normal function and echoing results on screen, the result is as wanted. If I do queries in this pic_Kayrat.php file (which should draw a line chart), query gives the wanted result and some weird markings (special characters ?) at the end of the result. I can draw the result as a string to the chart. Trim-function helps only when I draw the string. I cannot use the result variable (not even the trimmed one). I don't know why.

So, now I do my queries in a function which is handled before the <img>-tag. I save results in a text file. Then I read the text file in the pic_Kayrat.php file. After that, I have to do the trim-stuff and everything works like a charm.

Now I hope this "solution" is helpful for others.
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0450s ][ Queries: 11 (0.0042s) ][ GZIP on ]