1
votes

I just took like 45 minutes doing a tut for it not to work my code is here:

<?php 
$path = dirname(__FILE__); 

include("{$path}//config.inc.php"); 
include("{$path}//mc.inc.php"); 

?> 

and this is what the webpage shows:

Warning: include(C:\xampp\htdocs\NationKong site\core//mc.inc.php): failed to open stream: No such file or directory in C:\xampp\htdocs\NationKong site\core\init.inc.php on line 6

Warning: include(): Failed opening 'C:\xampp\htdocs\NationKong site\core//mc.inc.php' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\NationKong site\core\init.inc.php on line 6 $config Server Status

1

1 Answers

0
votes

you are on Windows, Directory separator is \, in a php string it would be "\\" so you should write

<?php 
$path = dirname(__FILE__); 

include("{$path}\\config.inc.php"); 
include("{$path}\\mc.inc.php"); 
?> 

if you like to make php to determine the right directory separator for you, just use DIRECTORY_SEPARATOR

<?php 
$path = dirname(__FILE__); 

include($path.DIRECTORY_SEPARATOR."config.inc.php"); 
include($path.DIRECTORY_SEPARATOR."mc.inc.php"); 
?>