RE: [PHP] connecting to a txt file - newbie

From: Date: Thu, 10 Oct 2002 14:18:41 +0000
Subject: RE: [PHP] connecting to a txt file - newbie
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-119530@lists.php.net to get a copy of this message
Try: <?php $file = @file('text.txt'); if (!$file) { echo "Ouch ... I couldn't open the file..."; } for ($i = 0, $count = count($file); $i < $count; $i++) { echo $file[$i]; } ?> Timothy Hitchens (HITCHO) tim@hitcho.com.au HITCHO has Spoken! -----Original Message----- From: jennifer [mailto:jennifer@whitenoisemachine.net] Sent: Friday, 11 October 2002 12:14 AM To: php-general@lists.php.net Subject: [PHP] connecting to a txt file - newbie good morning, im having some issues with the simple task of pulling from a txt file. my code is: <html> <head> <title>job app</title> </head>db <body> <?php if(!$file=fopen("text.txt", "r")) { echo("couldnt open the file"); } else { $text = fread($file, 100); fclose($file); } ?> </body> </html> and the txt file contains one line of bogus txt. you can see my results here: http://www.villany2k1.com/text.php. if anyone has any info as to what i am doing wrong, i would really appreciate it. thanks so much jennifer (jennifer@whitenoisemachine.net) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#119530) next »