PDA

View Full Version : PHP Question - Saving to *.txt



Akalon
July 14th, 2001, 03:28
Hi, can someone please post the code to print a variable into a text file called 'messages.txt', I know it uses something like 'fopen' but can someone please help me out here... thanks :)

SplashHost.com
July 14th, 2001, 10:32
$fp=fopen("messages.txt", "w");
fwrite($fp, $textstring);

fclose($fp);

I think that should write $textstring into the text document messages.txt.

Hope it works

Akalon
July 14th, 2001, 20:24
Thanks, but it did not work, for some reason it does not come up with an error, but it does not save the information to a file either.

gyrbo
July 15th, 2001, 07:55
Is the file CHMODed write? And does the file allready exists?