you have 2 spaces between My and Documents in those, not to mention that if you are going to set $filename to be the path/file name, you may as well use it in your fopen() call as well.
other than that is actually looks correct, although - you don't have < or > around your HTML tag, you should use <?php rather than <? and I wouldn't personally suggest storing files in a path with a space in it, if you can avoid it, since that may actually cause problems. hope something there helps beau // -----Original Message----- // From: roslyn jose [mailto:[EMAIL PROTECTED]] // Sent: Monday, 23 September 2002 1:45 PM // To: [EMAIL PROTECTED] // Subject: RE: [PHP-DB]opening and reading from file // // // // hi, the error is on line5. the error is: Parse error: parse error in // /var/www/html/learn/frames.php // // html // // <body> // // <? // // $filename="C:\\Documents and Settings\\roslyn\\My // Documents\\note.txt"; // $fp = fopen ("C:\\Documents and Settings\\roslyn\\My // Documents\\note.txt", "r"); // $contents = fread ($fp, filesize ($filename)); // echo $contents; // fclose ($fp); // ?> // </body> // // </html> // // regards, // // roslyn // // Beau Lebens wrote:what exact error are you getting, and // what line is it on etc? // // beau // // // // -----Original Message----- // // From: roslyn jose [mailto:[EMAIL PROTECTED]] // // Sent: Monday, 23 September 2002 1:07 PM // // To: [EMAIL PROTECTED] // // Subject: RE: [PHP-DB]opening and reading from file // // // // // // // // hello again, // // i tried what u told me but im still getting the same error // // at the fopen(.....). any other bright ideas. please help. // thanx alot // // // // // $filename="C:\\Documents and Settings\\roslyn\\My // // Documents\\note.txt" // // $fp = fopen ("C:\\Documents and Settings\\roslyn\\My // // Documents\\note.txt", "r"); // // $contents = fread ($fp, filesize ($filename)); // // echo $contents; // // fclose ($fp); // // ?> // // // // regards, // // roslyn // // Beau Lebens wrote:just use // // // // $filename = "C:\\Documents and Settings\\roslyn\\My // // Documents\\note.txt"; // // // note double-slashes // // $contents = join('', file($filename)); // // echo $contents; // // ?> // // // // should work. your parse error is probably because of the // "\" in your // // filename, you need to escape them with another "\". // // // // HTH // // // // Beau // // // // // -----Original Message----- // // // From: roslyn jose [mailto:[EMAIL PROTECTED]] // // // Sent: Monday, 23 September 2002 12:54 PM // // // To: [EMAIL PROTECTED] // // // Subject: RE: [PHP-DB]opening and reading from file // // // // // // // // // HI,IVE BEEN TRYING TO PRINT THIS CODE, BUT KEEP GETTING AN // // // ERROR: // $filename="C:\Documents and Settings\roslyn\My // // Documents\note.txt" // // // $fp = fopen ("C:\Documents and Settings\roslyn\My // // // Documents\note.txt", "r"); // // // $contents = fread ($fp, filesize ($filename)); // // // echo $contents; // // // fclose ($fp); // // // ?> // // // THE ERROR I GOT WAS THIS:Parse error: parse error in // // // /var/www/html/learn/frames.php COULD SOMEONE PLS HELP ME // // // OUT EHRE, I JUST WANT TO PRINT THIS FILE, THATS ALL. // // // THANKSREGARDS ROSLYN // // // // // // // // // // // // John Holmes wrote:Try $_POST['field_1'] instead of $field_1 // // // // // // ---John Holmes... // // // // // // > -----Original Message----- // // // > From: Warren Massengill [mailto:[EMAIL PROTECTED]] // // // > Sent: Thursday, September 19, 2002 8:19 PM // // // > To: [EMAIL PROTECTED] // // // > Subject: [PHP-DB] Form response // // // > // // // > Hi, // // // > // // // > RedHat 7.2 RPM with PostgreSQL 7.1.x and PHP 4.0.6 // // // > // // // > Page 111 of "PHP and PostgreSQL", this form displays in // // // Mozilla. The // // // > submit // // // > button is expected to run a script called reaction.php // // but it opens // // // the // // // > script and displays the code. The response is the same // // // with or without // // // > variable input. // // // > // // // > I changed the script file to executable: no effect. // // // > // // // > I can run 'reaction.php' from the shell and it works. // // // > What is the problem here? // // // > --------------------------------- // // // > form // // // > // // ----------------------------------------------------------------- // // // > // // // > // // // > A Simple Form // // // > // // // // // // // // // > // // // > [input] // // // // // // // // // > [input] // // // > // // // > // // // > // // // > // // // > ------------- // // // > Reaction.php // // // > // // ------------------------------------------------------------------ // // // > action.php // // // > // // // > > if ($field_1) // // // > { // // // > echo "field_1: $field_1"; // // // > } // // // > else // // // > { // // // > echo "nothing has been passed to this script"; // // // > } // // // > ?> // // // > ---------------------- // // // > run as stand alone php file // // // > // // ----------------------------------------------------------------- // // // > // // // > bash-2.05$ php < reaction.php // // // > X-Powered-By: PHP/4.0.6 // // // > Content-type: text/html // // // > nothing has been passed to this script // // // > // // // > // ---------------------------------------------------------------- // // // > // // // > In: // // // > /etc/httpd/conf/httpd.conf // // // > AddType application/x-httpd-php .php // // // > (appears as above plus an entry for each of php2,3,&4) // // // > LoadModule php4_module modules/libphp4.so // // // > LoadModule php_module modules/mod_php.so // // // > // // // > These were all uncommented in the RPM installation of // // RedHat 7.2. // // // > Somehow PHP is partially working... // // // > Any suggestions? // // // > // // // > I can create forms in php and tables in PostgreSQL but // // according to // // // > phpinfo(), php is not configured for PostfreSQL. // // // > // // // > If I survive this problem, that one is on the horizon. // // Does anyone // // // have a // // // > generic list of things to do after an RPM installation of // // // RedHat Linux // // // 7.2 // // // > in order to use PHP with PostgreSQL? // // // > // // // > Thanks, // // // > Warren // // // > // // // > // // // > // // _________________________________________________________________ // // // > Send and receive Hotmail on your mobile device: // // http://mobile.msn.com // // > // // > // // > -- // // > PHP Database Mailing List (http://www.php.net/) // // > To unsubscribe, visit: http://www.php.net/unsub.php // // // // // // -- // // PHP Database Mailing List (http://www.php.net/) // // To unsubscribe, visit: http://www.php.net/unsub.php // // // // // // // // --------------------------------- // // Do you Yahoo!? // // New DSL Internet Access from SBC & Yahoo! // // // // -- // // PHP Database Mailing List (http://www.php.net/) // // To unsubscribe, visit: http://www.php.net/unsub.php // // // // // // // // --------------------------------- // // Do you Yahoo!? // // New DSL Internet Access from SBC & Yahoo! // // // // -- // PHP Database Mailing List (http://www.php.net/) // To unsubscribe, visit: http://www.php.net/unsub.php // // // // --------------------------------- // Do you Yahoo!? // New DSL Internet Access from SBC & Yahoo! // -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php