PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Mon Sep 16, 2019 12:17 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Mon Feb 12, 2007 11:04 pm 
Offline
Forum Newbie

Joined: Mon Feb 12, 2007 10:50 pm
Posts: 18
hi

i have the following problem:
i am working with jpgraph library and i use mostly pie graphs
the way i use them is calling them in IMG tags , like this
<img src='graph1.php'>
in graph1.php, i make a query to database in order to obtain results for displaying in the graphic

if my query returns no rows , i show an empty graphic with text "NO INFORMATION FOR YOUR SEARCH"

the problem is when i display 5 or 6 graphics in the same page, if any of them return information, i see 5 graphics with text
"NO INFORMATION FOR YOUR SEARCH", i don´t want this display

what i was researching is a way to load the graphics first and keep them in a php var, if it´s posible

i hope you understand my question
and if there is a fast or better way to work with this kind of graphics, i hope any advice

i´d appreciate any help


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 12, 2007 11:20 pm 
Offline
DevNet Master
User avatar

Joined: Wed Dec 06, 2006 5:14 pm
Posts: 3635
Location: Toronto, Canada
Sorry - I'm not clear on what you're trying to do exactly - can you provide a URL maybe?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 12, 2007 11:39 pm 
Offline
Forum Newbie

Joined: Mon Feb 12, 2007 10:50 pm
Posts: 18
i have a main page where i have to display some graphics , in this page i call the graphics in this way:

<img src='graph1.php' width='400' height='200'>

inside graph1.php i make a query to database and with the results i display a pie graph
i use jpgraph library for this
i also check if my query returns rows, if it doesn´t, i display an image with the text "NO INFORMATION.."

what i want to do is call graph1.php before displaying it in IMG tags and save it in a php variable
so i can check if it brings no information before showing graphics

:O


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 12, 2007 11:48 pm 
Offline
DevNet Master
User avatar

Joined: Wed Dec 06, 2006 5:14 pm
Posts: 3635
Location: Toronto, Canada
you could record the file size of the "NO INFORMATION.." graphic and test that way, not bothering to display the <img/> tag if it matches. Graph caching might be a nice feature at that point though, since you'll essentially be creating the image twice.

For that matter, why not just test for the existence of your graph data rows before adding the <img/> element?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 14, 2007 1:03 am 
Offline
Forum Newbie

Joined: Mon Feb 12, 2007 10:50 pm
Posts: 18
when i display the image in <img src='graph1.php'> i can´t check the size of the image before displaying it

i used the cache and it worked well, sadly i´am not allowed to use caching in the production server

the reason why i don´t check if there is no rows before displaying the graphic is because i directly call the graphic, which i prepare in graph1.php,
it brings me a graphic as a result of calling it

all my query is made in this graph1.php

a solution is to make the graphic querys before displaying, but i would be making the quey twice


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 14, 2007 1:55 am 
Offline
DevNet Resident

Joined: Thu Mar 10, 2005 6:27 pm
Posts: 1027
Location: Southern Ontario
the best way to defeat the caching is to use a unique url with each request. append a random string to the url on each request and the caching should stop..


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 14, 2007 6:45 am 
Offline
Breakbeat Nuttzer
User avatar

Joined: Wed Mar 24, 2004 8:57 am
Posts: 13098
Location: Melbourne, Australia


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 14, 2007 6:47 am 
Offline
Breakbeat Nuttzer
User avatar

Joined: Wed Mar 24, 2004 8:57 am
Posts: 13098
Location: Melbourne, Australia


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group