Hi
I've been able to read and write to text files ok in the past, but this one is bugging me as I can't figure this out.
if ($userinformationresult == "correct") {
$fileurl = "incs/users.txt";
$fd = fopen ("$fileurl", "r+");
while (!feof ($fd)) {
$buffer = fgets($fd, 1024);
$buffer = eregi_replace($oldpassword, $newpassword, $buffer);
//echo $buffer; this will echo the data fine, and as I want it
$writesuccess = fwrite($fd, $buffer);
}
fclose ($fd);
All I want to do, is open a text file, search for one word, and replace it and then save the text file again.
I'm not sure if its the mode? r+ seems right to me!
the problem is definately the fwrite line, but I've been looking in the manual for ages with no luck!
Anyone see what is wrong?
cheers