PDA

View Full Version : reading a text file - need help



n2dweb
September 7th, 2007, 08:48 PM
In php am reading a file with the following text:
__________
<p>test</p>
<?php include("include/newlyaddeditems.php");?>
<table width="100%"><tr><td height="77" align="center"><p>
<a href="new.php"><b>View All of our new items</b></a></p>
</td></tr></table>
__________


using the php code below:

__________
<?php
// file example 1: read a text file into a string with fgets
//
$filename= 'hpl.txt' ;
$output="";
$file = fopen($filename, "r");
while(!feof($file)) {
//read file line by line into variable
$output = $output . fgets($file, 4096);
}
fclose ($file);
echo $output;
__________

the echo $output gives me all the text except for the php include line.
Why? and can someone please help!:alien:
Thanks J

Esherido
September 8th, 2007, 07:51 AM
I'm not exactly sure, have you checked the manual for fopen and fgets? That would be the first thing I did, the next might be to check your PHP settings because there might be something in the there that's causing that to happen.