Help with fwrite(), i don't want its returns!

So, first off I may be going about this completely wrong since i’m a complete php newb.

What i’m doing:

I have a page, we’ll call it mypage.php
in mypage.php, using various loops I am generating a page realtime by echoing the output of my loops. I am also creating .html pages elsewhere and then linking to them. The problem is fwrite() returns how many bytes its written and it gets on the original page. Example:


while (some condition){
echo “<a href=“mynewpage.html”>mynewpage” //This should be on the current page
$fp = fopen ($fp,“mynewpage.html”);//This should create the linked page
echo fwrite($fp, “”);
echo fwrite($fp, “”);
echo fwrite($fp, “SOME CONTENT”);
echo fwrite($fp, “”);
echo fwrite($fp, “”);
The problem I’m ending up with is that on the “current page” or “first page” fwrite returns the number of bytes its written, so I end up with the returns from fwrite scattered throughout the links on that inital page.

Any guidance you guys provide would be appreciated.

Why are you echoing the fwrites? you’re missing the ; at the end of the link echo and at the end of the fclose.

Where is it writing the byte size?

Sponsor our Newsletter | Privacy Policy | Terms of Service