Results 1 to 2 of 2

Thread: php include question

  1. #1

    Thread Starter
    Frenzied Member joefox's Avatar
    Join Date
    Oct 2004
    Posts
    1,318

    php include question

    weird i dont know what im doing wrong

    i made a file called mysql_conn.php and put it in the db_conn folder

    i have my main index.php in the php folder

    php(folder)
    images(folder)
    db_conn(folder)

    but when i try to include the DB_conn file it says

    Warning: main(./db_conn/mysql_conn.php) [function.main]: failed to open stream: No such file or directory in C:\Inetpub\jf1\a\php\index.php on line 9

    Warning: main() [function.include]: Failed opening './db_conn/mysql_conn.php' for inclusion (include_path='.;c:\php4\pear') in C:\Inetpub\jf1\a\php\index.php on line 9


    Here is my include statment:
    <?php
    //connection to database
    include('./db_conn/mysql_conn.php');
    ?>

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: php include question

    Well, is db_conn a subdirectory of the current working directory, as index.php sees it?

    The answer is no, db_conn is a sibling. You want '../db_conn/mysql_conn.php' as the file path.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width