Jump to content

Question about fputs


dhuan

Recommended Posts

how can i make the fputs/fwrite command writte at the beginning of the file instead of at the end of file?

 

Here's my code:

$fp=fopen($file,a);

fwrite($fp,$save);

 

I tested my code, it worked and all, the problem is, i want "$save" to be written before everything's been written, not after!    (i'm sorry if i didnt make myself clear enough, english aint my first language, i'm tryin my best though!)

Link to comment
https://forums.phpfreaks.com/topic/147356-question-about-fputs/
Share on other sites

HEY THANKS! ;D

i didnt do exactly what you told me, but you mentioned that code "file_get_contents" that i'd never heard of before.

 

here's what i did:

 

$old=file_get_contents($file);

 

$save="$contentfilledintheform <br> $old";

 

$fp=fopen($file,w);

fwrite($fp,$save);

 

 

and guess what! it worked like a charm

thanks again, pal! ;D ;D ;D ;D

Link to comment
https://forums.phpfreaks.com/topic/147356-question-about-fputs/#findComment-773492
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.