Page 1 of 1

function loads before page

Posted: Wed Nov 01, 2006 2:39 pm
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

Posted: Wed Nov 01, 2006 2:45 pm
by feyd
Finish the page's output first?

Posted: Wed Nov 01, 2006 2:53 pm
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.

Posted: Wed Nov 01, 2006 3:04 pm
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.

Posted: Wed Nov 01, 2006 3:15 pm
by tarja311
Thank you. flush(); worked. :)