Jump to content

Include() not working cannot link to external files


celblock

Recommended Posts

I am trying to set my db connection in another file and folder than my main index.php.

When i include the db connection in the index.php everything works fine. but when i uses include ("include/config.php");

all that happens is the php code gets displayed.

 

I have one script where this function actually works, but every other script i have ever tried to use has this problem where i can not use inlcude to link to an external file

 

Is their something wrong with my php.ini config

Link to comment
Share on other sites

it looks like this

 

<?php

include ("include/config.php");

session_start();

include ("include/function.php");

?>

 

 

 

session declaration should always be on the topmost of the page right before <? or else youll get a warning message saying something about header etc..

and can we see the code for  include ("include/config.php");

Link to comment
Share on other sites

session declaration should always be on the topmost of the page right before <? or else youll get a warning message saying something about header etc..

and can we see the code for  include ("include/config.php");

 

Err, if you placed the call to session_start() before the php opening tag, then it wouldn't be parsed. It would be useless. I assume you mean just after the opening tag.

 

Either, way, its not true. It must simply come before any headers are sent or the $_SESSION array is used.

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.