Issues With MySql Server Connection Attaching As require_once

33 views Asked by At

When I type in the direct URL to access the page that holds the database connection, db_connect.php on the website, it brings back a message of being successful. When I require it once on my master header page to determine what to show the website visitor (ie. if they're logged in it will show a set of links. If not, it will show a different set) it suddenly decides to error out and kills the rest of the PHP on the page. When I get rid of the require_once that links to the DB connection, all the PHP works fine. I've even tried using a relative URL. I am going to try one last thing but just wanted to get input on this. My guess is that I can't store the database connection in a folder.

<?php
    require_once("account-management/db_connect.php");
    session_start();
    
        if (isset($_SESSION['user_lister_id']) && ($_SESSION['email'])) {
            echo '<section class="topnavbar">';
            echo '<div id="top-login">';
            echo '<a href="#">Listing Profile</a> / <a href="#">Account Settings</a> / <a href="#">Case Requests</a>';
            echo '</div>';
            echo '</section>';
        } else {
            echo '<section class="topnavbar">';
            echo '<div id="top-register">';
            echo '<a href="#">Client Register</a> / <a href="#">Lister Register</a>';
            echo '</div>';
            echo '<div id="top-login">';
            echo '<a href="#">Client Login</a> / <a href="#">Lister Login</a>';
            echo '</div>';
            echo '</section>';
        }
?>
            <section class="header-grid">
        <img src="../images/Logo.png" width="120" />
        <div id="ad-field">This content coming soon!</div>
</section>
0

There are 0 answers