Search code examples
phpmysqldatabasemysqlidirection

MYSQL PHP direction error


[31-Oct-2014 12:47:24 UTC] PHP Warning:  include_once(../connect/con.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: No such file or directory in /home/denzw681/public_html/u/userPages/check_login_status.php on line 3
[31-Oct-2014 12:47:24 UTC] PHP Warning:  include_once() [<a href='function.include'>function.include</a>]: Failed opening '../connect/con.php' for inclusion (include_path='.:/opt/alt/php53/usr/share/pear:/opt/alt/php53/usr/share/php') in /home/denzw681/public_html/u/userPages/check_login_status.php on line 3
[31-Oct-2014 12:47:24 UTC] PHP Notice:  Undefined variable: con in /home/denzw681/public_html/u/userPages/check_login_status.php on line 26
[31-Oct-2014 12:47:24 UTC] PHP Warning:  mysqli_query() expects parameter 1 to be mysqli, null given in /home/denzw681/public_html/u/userPages/check_login_status.php on line 15
[31-Oct-2014 12:47:24 UTC] PHP Warning:  mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in /home/denzw681/public_html/u/userPages/check_login_status.php on line 16

I have folders this way:

>> public_html/u/connect/con.php

>> public_html/u/userPages/check_login_status.php

>> public_html/u/userPages/php_parsers/photo_system.php

Not sure how to sulve this issue (

I can add the files code if needed to answer this question.

P.S. website is http://www.U.example.com/


Solution

  • You can try using the root of your site, with:

    include_once($_SERVER['DOCUMENT_ROOT']."/u/connect/con.php");
    

    Or you can use the magic constant:

    define( 'ROOT_PATH', dirname( dirname( __FILE__ ) ) );