Anyone familiar with PHP AND MYSQL WEB DEVELOPMENT, 2nd edition, by Luke Welling and Laura Thomson? And perhaps working on the Macintosh-UNIX side of things via OS X.whatever? If so, I ask for your indulgence and assistance.

Following advice given me a coupla weeks ago--on this very list, I believe--I've bought it to ground myself firmly in PHP and MySQL both, before moving on to my platform- and HTML editor-specific choices.

In this case--not surprising, given my second question above--I'm learning the UNIX brand on the Macintosh OS X.whatever side of things to eventually work with this Dreamweaver MX I've heard is so convenient with which to work. That is, once I've properly learned the PHP/HTML underpinnings.

And so I've gotten as far as chapter two running the book's code, before a problem's occurred that I can't get a handle on. It's obviously because I'm new to the world of UNIX and its file conventions.

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');

flock($fp, LOCK_EX);

if (!$fp)
{
echo '<p><strong> Your order could not be processed at this time. '
.'Please try again later.</strong></p></body></html>';
exit;
}


     fwrite($fp, $outputstring);
     flock($fp, LOCK_UN);
     fclose($fp);

echo '<p>Order written.</p>';
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


Your order could not be processed at this time. Please try again later.
Can someone point out what I need to do here to make this work?


Thank you.

Stephen Tiano

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



Reply via email to