Hi
I have been working my way through “BUILD YOUR OWN DATABASE DRIVEN WEB SITE USING PHP & MYSQL” 4th Edition and all was going well until I got to Chapter 7. I just can’t seem to get the DOCUMENT_ROOT working. As I am working through this book, I am a novice at both PHP and mySQL.
I am using Dreamweaver to open and edit my PHP and HTML files. Also, I am using MAMP because I am on a Macintosh (OSX 10.6.2). I followed the set up instructions in the book, including using the Terminal to make some changes. (That seemed to me to be much simpler than the other set-up described in the book.)
In the earlier chapters which used include files in the same directory as the calling file, everything worked.
When I try to run the examples that have includes using $_SERVER[DOCUMENT_ROOT] then everything fails with the following error message (I have display_errors = On):
Warning: include_once(/Applications/MAMP/htdocs/includes/magicquotes.inc.php) [function.include-once]: failed to open stream: No such file or directory in /Applications/MAMP/htdocs/phpmysqlcode_archive/chapter7/admin/jokes/index.php on line 3
Warning: include_once() [function.include]: Failed opening ‘/Applications/MAMP/htdocs/includes/magicquotes.inc.php’ for inclusion (include_path=‘.:/Applications/MAMP/bin/php5/lib/php’) in /Applications/MAMP/htdocs/phpmysqlcode_archive/chapter7/admin/jokes/index.php on line 3
Warning: include(/Applications/MAMP/htdocs/includes/db.inc.php) [function.include]: failed to open stream: No such file or directory in /Applications/MAMP/htdocs/phpmysqlcode_archive/chapter7/admin/jokes/index.php on line 306
Warning: include() [function.include]: Failed opening ‘/Applications/MAMP/htdocs/includes/db.inc.php’ for inclusion (include_path=‘.:/Applications/MAMP/bin/php5/lib/php’) in /Applications/MAMP/htdocs/phpmysqlcode_archive/chapter7/admin/jokes/index.php on line 306
Notice: Undefined variable: link in /Applications/MAMP/htdocs/phpmysqlcode_archive/chapter7/admin/jokes/index.php on line 307
Warning: mysqli_query() expects parameter 1 to be mysqli, null given in /Applications/MAMP/htdocs/phpmysqlcode_archive/chapter7/admin/jokes/index.php on line 307
Hopefully someone who has worked through this book successfully with a similar set up to me (Dreamweaver and MAMP) will be able to help me.
Many thanks in advance
Cliff