Reputation: 358
I am adding a absolute path with the php include.
$path ="/";
instead of include('../connect.php');
i want to include like include($path.'connect.php');
Upvotes: 0
Views: 289
Reputation: 5240
I am using something simular then that. I am using a p value out of the link to get my page. I pulled out the snippet you are refering too here
$pages_dir = 'inc/content';
include($pages_dir.'/'.$p.'.inc.php');
Upvotes: 2
Reputation: 10236
If you are using any framework, then follow that, otherwise you can do following:
$path = __DIR__;
include($path . '/connect.php'); // change this to match path
Upvotes: 3