Page 1 of 1

what is the meaning of this Resource id #4

Posted: Tue Dec 30, 2008 3:33 am
by tinoda
i keep getting the: Resource id #4 as my output each time i try to run this script. where am i going wrong.

<?PHP

$file_contents = fopen("testFile.txt", "r");
print $file_contents;
fclose($file_contents);

?>

Re: what is the meaning of this Resource id #4

Posted: Tue Dec 30, 2008 3:43 am
by VladSun
tinoda wrote:i keep getting the: Resource id #4 as my output each time i try to run this script. where am i going wrong.

<?PHP

$file_contents = fopen("testFile.txt", "r");
print $file_contents;
fclose($file_contents);

?>
It's a file handle. If you need the file contents use filegetcontents instead of fopen OR you should read the file line by line -fgets(), or block by block - fread() after opening it.

Re: what is the meaning of this Resource id #4

Posted: Tue Dec 30, 2008 3:51 am
by tinoda
It's a file handle. If you need the file contents use filegetcontents instead of fopen OR you should read the file line by line -fgets(), or block by block - fread() after opening it.
you know what Vladsun you are just the person of the day today. u really brightened my day, vielen danke, thank u very much - it worked