$file = "./txtfiles/" . str_replace(" ", "_", $username) . ".txt";
$fp = fopen($file, "r");
$thing = fread($fp);
echo $thing;
fclose($fp);
is not echoing the contents of the file.
the file was created with the following script:
$file = "./txtfiles/" . str_replace(" ", "_", $name) . ".txt";
$neat = fopen($file, 'w');
$wow = fwrite($neat, 'Edit this');
fclose($neat);
that script is working... if there's a space in the username, it converts the space to a _ when saving (because yahoo doesnt like spaces in filenames).
anyone got an idea?
EDIT: oops, shouldnt be so hasty when im scripting... looks like i forgot to include what $name is in the read file...
ANOTHER EDIT: well, i did include what the $name in this time... and well, it still doesnt work.
any suggestions?
ONE LAST EDIT: ok nate helped me out on AIM. the probably was that i needed to have a filesize in the fread() function.a couple things come to mind:
1. I thought you have to give a size to the fread function: $thing = fread($fp, filesize($file));
2. You may want to put $fp = fopen($file, "r") in an if statement to make sure fopen succeeds.
3. Yout might want to take a look at the file_get_contents function
4. Should it be $name instad of $username ?
$fp = fopen($file, "r");
$thing = fread($fp);
echo $thing;
fclose($fp);
is not echoing the contents of the file.
the file was created with the following script:
$file = "./txtfiles/" . str_replace(" ", "_", $name) . ".txt";
$neat = fopen($file, 'w');
$wow = fwrite($neat, 'Edit this');
fclose($neat);
that script is working... if there's a space in the username, it converts the space to a _ when saving (because yahoo doesnt like spaces in filenames).
anyone got an idea?
EDIT: oops, shouldnt be so hasty when im scripting... looks like i forgot to include what $name is in the read file...
ANOTHER EDIT: well, i did include what the $name in this time... and well, it still doesnt work.
any suggestions?
ONE LAST EDIT: ok nate helped me out on AIM. the probably was that i needed to have a filesize in the fread() function.a couple things come to mind:
1. I thought you have to give a size to the fread function: $thing = fread($fp, filesize($file));
2. You may want to put $fp = fopen($file, "r") in an if statement to make sure fopen succeeds.
3. Yout might want to take a look at the file_get_contents function
4. Should it be $name instad of $username ?