Jump to content

[SOLVED] A little problem, the code is not doing what it should!!!


npsari

Recommended Posts

I put an index.php in a folder called details. The index.php contains only the following...

 

<?

$Connection='localhost';

$Name='TheName';

$Password='ThePassword';

$Database='DatabaseName';

?>

 

Then, i connect to a database in any other page doing this...

 

<?

 

include"/details/index.php";

 

$con=mysql_connect("$Code", "$Name", "$Password");

mysql_select_db("$Database", $con);

 

?>

 

But it doesnt work and doesnt connect succesfully, why!!!

Link to comment
Share on other sites

no they dont have to be in the same folder.  you can have the files in the main directory, and index.php in a sub folder.  If this is how you have it set up, the code I give you will work.  If you have to go back a directory, then you have to put in .. before the file path.

Link to comment
Share on other sites

ohh, that is new to me the two dots thing ..

 

So, my file with the details is in  www/details/index.php

 

and i want to link to it from www/codes/sub/index.php

 

what should the include be like

 

include ("???");

 

it will be great if you show me plz

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.