Help with PHP

Discussion in 'Web Design and Development' started by mdzwolf, Jun 9, 2006.

  1. mdzwolf macrumors member

    Joined:
    Oct 13, 2005
    #1
    Hey everyone, I am trying to create a php site and the first part is a user login system. I wrote the database functions and put them in a seperate file called MySQL.php and I am trying to use require_once to include the file. However whenever I use the require_once, require, or include command the script doesn't execute it just loads to a blank page and doesn't even show any html or the document title. As soon as I comment out that line it works fine, such as showing the result of phpinfo() and any html in the document. I am totally lost as to why this is. Below is how I have the lined coded:

    require_once('./database/mysql.php');

    Here is how the code is written:

    PHP:
    <?php
    require_once('./database/mysql.php');

    phpinfo();
    ?>


    <html>
    <body>
    hey
    </body>
    </html>
    Any help would be greatly appreciated!
     
  2. superbovine macrumors 68030

    superbovine

    Joined:
    Nov 7, 2003
    #2
    post your code be sure to use the php blocks tag in the post.
     
  3. thejadedmonkey macrumors 604

    thejadedmonkey

    Joined:
    May 28, 2005
    Location:
    Pa
    #3
    Make sure the MySQL.php file starts and ends with php tags.
    use " instead of ' in the include/require

    see if any of that helps.
     
  4. RupertJ macrumors newbie

    Joined:
    Dec 30, 2004
    Location:
    Bristol, UK
    #4
    That'll make no difference in this case.

    A blank screen usually means there's a parse error on the page. Look in the PHP error log (or webserver error log, depending on your server and settings) and you'll find the error message there. the code you quoted looked fine, so you'll probably find the error in the included file.
     

Share This Page