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
https://forums.phpfreaks.com/topic/98893-error-on-include/
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
https://forums.phpfreaks.com/topic/98893-error-on-include/#findComment-506090
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.