fopen() works, include() and file_get_contents() don't
WhosAWhata
10:39 pm on Aug 10, 2004 (gmt 0)
function edit($when,$time,$what){ $file = "days/".$when.".txt";
coopster
1:34 pm on Aug 11, 2004 (gmt 0)
So the variable, $file, is going to contain the path and filename? Next comes your PHP file function, be it one of the three mentioned in the title of this thread, fopen(), include() or file_get_contents(), but only fopen() is working? You didn't show this part, so that is what I am assuming. If you try the others, do you get any error messages?
WhosAWhata
2:37 pm on Aug 13, 2004 (gmt 0)
if i include($file) i get the file does not exist error, if i do $variable=file_get_contents($file) the $variable is blank but no error message, if i use fopen($file,w); it properly overwrites the file
coopster
3:54 am on Aug 14, 2004 (gmt 0)
file_get_contents() should return a WARNING error (if error_reporting is turned on to show WARNINGS) when the file is not found.
The fopen() mode of 'w' will open for writing only and if the file does not exist PHP will attempt to create it. That's probably why fopen() is working.