Re: includes linking to other files, help with relatives

From: Date: Mon, 07 Dec 2009 06:16:23 +0000
Subject: Re: includes linking to other files, help with relatives
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-300263@lists.php.net to get a copy of this message
Hello Allen McCabe, it doesnt matter from which folder you call the database.php file..... only thing u must take care is to use correct path in the database.php file so that key.txt is accurately referenced..... if you are still having problems, use absolute paths instead of relative path...hers a reference http://www.ibdhost.com/help/path/.... GL... Midhun Girish On Mon, Dec 7, 2009 at 11:17 AM, Allen McCabe <allenmccabe@gmail.com> wrote: > I am creating a database connection path that check for a session variable > to get the username, password, dbname, etc., but if the session has not > been > set yet, I need my script to get those values from another file > (KEY.txt) where they are saved. I want to access this class from two > directories, and this text file (KEY.txt) is in a directory above both. > Like > this: > > root: folder1 - folder2 > > folder1: KEY.txt > > folder2: index.php - database.php - folder3 > > folder3: index.php > > I need to use database.php in both index files, but database.php references > KEY.txt. So my question is, do I have to check which directory the calling > script is in (ie. which index.php file is using database.php) and add the > according up directory references, or do I need to use some kind of > $_SERVER[DOCUMENT_ROOT] > thing? > > Any help would be appreciated! >

« previous php.general (#300263) next »