need help on executing program

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bugthefixer
Forum Contributor
Posts: 118
Joined: Mon Mar 22, 2004 2:35 am

need help on executing program

Post by bugthefixer »

my site has a page which contains java applet
now i want to execute a program whenever this page is loaded and stop the program when page exits.
the program will be infact a php code which will create a table and after every 5 sec it will update the table..
any1 can tell me how it can be done
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

why not just have the page be this program, and set the page to refresh itself every 5 seconds?
bugthefixer
Forum Contributor
Posts: 118
Joined: Mon Mar 22, 2004 2:35 am

Post by bugthefixer »

well thanx feyd
but in this way my applet will be also refreshed and i dont want to do that..
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Does your server allow mid-script echos to print before the page is finished processing? Do you want to replace the table printed, or do you mind having many tables printed? Do you mind some (possible) browser incompatiblity for this?

if yes to the first question and yes to the first part of the second question:
You can use Javascript to replace the table that you output for each pass of the loop you'll create.

if yes to the first question and no to the second part of the second question:
You can output a new table every 5 seconds then.

For the two solutions I just gave, in my experiments with things like this, PHP often didn't acknowledge that I canceled the page, or navigated away, so beware.

if no to the last question:
You can use an iframe or frames to load this "program" page. Add a refresh and it takes care of user navigating away problem of the above solutions.
bugthefixer
Forum Contributor
Posts: 118
Joined: Mon Mar 22, 2004 2:35 am

Post by bugthefixer »

well the usage of frames u hav suggested sounds good to me..but can u tell me how can i refresh this frame after every 5 secs..i mean thru some sort of code
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

stick the following in the header section of the framed html

Code: Select all

<meta http-equiv="refresh" content="5">
Post Reply