* Thus wrote Stephen Tiano ([EMAIL PROTECTED]):
> 
> A file to read and write to has been provided on the book's CD. I've 
> copied this file, named "oders.txt", in a folder (directory) on my hard 
> drive, the path which runs like so:
> 
>    [hard drive name]/Library/WebServer/Documents/orders/orders.txt.
> 
> And the code the book uses to write to this file is:
> 
>    // open file for appending
>      $fp = fopen("$DOCUMENT_ROOT/../orders/orders.txt", 'a');

echo $DOCUMENT_ROOT;

You'll see exactly where php is looking for to open the file.  You
can either adjust the location where you copied the file or modify
the code to adjust for where you put it.  I would suggest the
former in case other examples use the same structure, you wont have
to deal with this when trying to learn the examples.

> 
>      flock($fp, LOCK_EX);

I'm not sure why the book doesn't try to lock the file after the
check for valid file handle. This is what causes the second error.

> Unfortunately, my browser--Netscape 7.02--gives the following in 
> response to that code:
>    
>    Warning: fopen(/Library/WebServer/Documents/../orders/orders.txt) 
> [function.fopen]: failed to
>    create stream: No such file or directory in
>    /Users/stephent/Sites/php_mysql_web_dev/chapter_02/processorder.php 
> on line 63
> 
>    Warning: flock(): supplied argument is not a valid stream resource
>    in /Users/[name I 
> use]/Sites/php_mysql_web_dev/chapter_02/processorder.php on line 65
> 

Curt
-- 
"My PHP key is worn out"

  PHP List stats since 1997: 
          http://zirzow.dyndns.org/html/mlists/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to