function loads before page

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
tarja311
Forum Commoner
Posts: 73
Joined: Fri Oct 20, 2006 10:57 pm

function loads before page

Post by tarja311 »

Hi all,

I have a function that gets called in the middle of my html document. This works fine... my problem is that the function gets called before the page is even done loading. so basically the page is blank until the function is finished doing its thing.

The way my code is setup is this way :

Code: Select all

<?php

function Check_Status()
{
  fsockopen(blah... );
}
?>
and then down here is the html stuff and the Check_Status call using

Code: Select all

<? Check Status(); ?>
Anyone else run into this kind of problem and/or know what to do in this kind of situation?

Thanks

--tarja
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Finish the page's output first?
tarja311
Forum Commoner
Posts: 73
Joined: Fri Oct 20, 2006 10:57 pm

Post by tarja311 »

Thanks for the reply; how would i go about doing that when the function is performing before the page's contents are loaded? If it means anything (probably not), the html code is not being echo'd by php, it is all by itself at the bottom of the page, with the function call.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Does this function call affect the output? If not, move to the end of the entire file. Possibly call flush() before calling the function.
tarja311
Forum Commoner
Posts: 73
Joined: Fri Oct 20, 2006 10:57 pm

Post by tarja311 »

Thank you. flush(); worked. :)
Post Reply