Jump to content

Recommended Posts

Hey,

 

I have 2 files, index.php and functions.php

 

in index.php

<?php if ($au=$_SESSION['_amember_user']){ // user is logged-in
print "<p>Hello $au[name_f] $au[name_l]!</p><br>";
print "<a href='/amember/logout.php'>Logout</a>";
} 
else { // user is not logged-in
                    
print '<p>Hello!</p>
<a href="javascript:login_fade();">Login</a>';

}?>

display_nav();

 

in functions.php

 

function display_nav(){
    $nav_display = mysql_query('SELECT * FROM `amember_payments` WHERE `member_id` = "' . $au[member_id] . '"');
    $nav = mysql_fetch_row($nav_display);
    
    //renders out the navigation depending on the user
    if($nav[2] == 1)
    {
        //user
        user_nav();
    }
    elseif($nav[2] == 2 || $nav[2] == 3)
    {
        //store
        store_nav();
    }
    else{
        //guest
    }
}

 

I have included the functions.php in index.php, but for some reason display_nav(); doesn't work. If i copy the function into index.php it works.

 

Why are my variables from index.php not working in function.php even though function.php is included in index.php

 

Any help is appreciated!

 

Thanks.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.