Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 414
  • Last Modified:

include in upper directory

the code below if    config.php    stay in the directory that is  upper than this  file stay how can i correct

include 'config.php';


<?php
include 'config.php';
include 'opendb.php';

$query  = "SELECT name, subject, message FROM contact";
$result = mysql_query($query);

while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
    echo "Name :{$row['name']} <br>" .
         "Subject : {$row['subject']} <br>" .
         "Message : {$row['message']} <br><br>";
}

include 'closedb.php';
?>
0
teera
Asked:
teera
  • 3
1 Solution
 
Lukasz ChmielewskiCommented:
I'm not sure if this is what you mean, but
if(file_exists("../'config.php")){
   // do someting
}
0
 
teeraAuthor Commented:
hi Roads_Roads

what ../  itmean upper directory or root directory or all of upper directory
0
 
Lukasz ChmielewskiCommented:
../
it means upper directory
./
means root
0
 
Lukasz ChmielewskiCommented:
What do you want to do, can you provide a natural language pseudocode ?
I mean
IF (THERE IS SOMETHING IN SOME DIR){
DO THIS
}
ELSE
{
DO THAT
}
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now