Page 1 of 1

[SOLVED] Reading from a text file ~ displays 2 times

Posted: Tue Jan 25, 2005 12:28 pm
by worm5252

Code: Select all

<?php
    $listFile = "latest.txt";
    if (!($fp = fopen($listFile, "r")))  
        exit("Unable to open the input file, $listFile.");
    $buffer = fread($fp, filesize($listFile));  
    print "$buffer<br>\n";  
    fclose($fp);
?>
<html>
<body bgcolor="4D5E6B">
<?php echo $buffer; ?>
</body>
</html>
This is displaying the contents of my text files 2 times, I only want it to display 1 time? any ideas?

Posted: Tue Jan 25, 2005 12:32 pm
by JAM
Either remove

Code: Select all

print "$buffer<br>\n";
...or...

Code: Select all

<?php echo $buffer; ?>
Preferably the first.

Posted: Tue Jan 25, 2005 12:38 pm
by worm5252
That was it, thanks man, I didn't even notice that