php include file

i am building a website and have to include some files but i am getting this error


Warning: include(../db/database.php) [function.include]: failed to open stream: No such file or directory in C:\wamp\www\cart\admin\includes\session-check.php  on line 9


here is the code:

home.php

<?php
include('includes/session-check.php');
?>

session-check.php

<?php
session_start();  
include('../db/database.php');
?>

database.php is a file in folder db

can you tell me what am i doing wrong?
<?php
include('includes/session-check.php');
?>

Open in new window

nandananushil1Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

doyledpCommented:
The include command performs the include relative to the original calling script. i.e. home.php in your case.

So the include('../db/database.php'); in fact refers to the file database.php that is in the db folder that is in the same folder as your home.php file. Can you check that this is the case.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
syedyounusCommented:
<?php
session_start();  
include('../db/database.php');
?>

change this to

<?php
session_start();  
include('db/database.php');
?>

assuming db(folder) --- is in admin folder

If this does not work let us know what is the exact location of the db folder
0
theodorejsalvoCommented:
If you use a full path to your include, then it will register no matter what directory the calling file is in.

Full paths start with the slash '/'.  For example:
include('/db/database.php');

Open in new window

0
gmckeown99Commented:
Do you have "include_path" set in php.ini? You can add multiple paths, just make sure they are outside your main document root.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.