Text File open and display

From: Date: Mon, 03 Mar 2003 08:57:33 +0000
Subject: Text File open and display
Groups: php.general 
Request: Send a blank email to php-general+get-137858@lists.php.net to get a copy of this message
Greetings learned PHP(eople), There have been a number of postings recently on opening and reading files, and whilst I have read `em all I fail to make sense of it all. Basicaly...I have a text file with entries in it...I wish to display the contents of this file line by line in an HTML table : At present all I get is a table with 1 row and all the text in it in a large messy blob..... ===================================================================== <html> <body> <?php $handle = fopen("fopen.txt","r"); echo '<table border="1"'."\n"; echo ' <tr>'."\n"; echo ' <td width="15%"><b>File Entries</b></td>'."\n"; echo ' </tr>'."\n"."\n"; //---------------------------------------- //For each line in the file-------- // while (fpassthru($handle)); //{ //Print them out to Table----------------- echo ' <tr>'."\n"; echo ' <td width="15%"><font size="2">'; echo fpassthru($handle); echo '</td></tr>'. "\n"; //} echo '</table>'; //fclose($handle); ?> </body> </html> ================================================= I have commented out those lines which fail and am stuck as to what the correct syntax should be. I have read up on nl2br,fgets and other posts on php.net, but ......harumphhhhhhhh.... Thanks -- Chris Blake Office : (011) 782-0840 Cell : 083 985 0379 It is reported that somewhere in the world, every 15 seconds, a woman gives birth to a child. She must be found and stopped.

« previous php.general (#137858) next »