Jump to content

error on include


EchoFool

Recommended Posts

I keep getting an error with an include of:

 

Warning: include(connect/include.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\css\layout1.php on line 4

 

Warning: include() [function.include]: Failed opening 'connect/include.php' for inclusion (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\css\layout1.php on line 4

 

This is the include causing the error:

<?php
include("connect/include.php");

 

 

This is the include script:

 

<?php
ini_set('error_reporting', E_ALL); 
$connect = mysql_connect("etc etc etc etc");

//error handle
if (!$connect) {
echo "Unable to connect to DataBase: " . mysql_error();
exit;
}

//error handle
if (!mysql_select_db("dbtest")) {
echo "Unable to select database: " . mysql_error();
exit;
}

If(strtolower($_SERVER['PHP_SELF']) == '/connect/include.php'){

header("location: ../login.php");
die;
}
?>

Link to comment
Share on other sites

The error is pretty self-explanatory

 

Not really...because i have the directory correct.

 

 

Anyway, the file that is "Calling" the include is in a folder named "css"

 

So lets say its called page.php so it is here : "/css/page.php"

Now page.php needs to include the file : "/connect/include.php"

 

I tried :

../connect/include.php as the "../" brings it back to the root so it can go from there to the folder but no such luck.

 

Hope you can help me out.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.