PDA

Click to See Complete Forum and Search --> : php include question


joefox
Nov 8th, 2006, 04:13 PM
weird i dont know what im doing wrong

i made a file called mysql_conn.php and put it in the db_conn folder

i have my main index.php in the php folder

php(folder)
images(folder)
db_conn(folder)

but when i try to include the DB_conn file it says

Warning: main(./db_conn/mysql_conn.php) [function.main]: failed to open stream: No such file or directory in C:\Inetpub\jf1\a\php\index.php on line 9

Warning: main() [function.include]: Failed opening './db_conn/mysql_conn.php' for inclusion (include_path='.;c:\php4\pear') in C:\Inetpub\jf1\a\php\index.php on line 9


Here is my include statment:
<?php
//connection to database
include('./db_conn/mysql_conn.php');
?>

CornedBee
Nov 8th, 2006, 05:12 PM
Well, is db_conn a subdirectory of the current working directory, as index.php sees it?

The answer is no, db_conn is a sibling. You want '../db_conn/mysql_conn.php' as the file path.