Basically I have a piece of php code with all of it's lines working and what they do is fetch the database data from certain session, now, the problem is that all lines are working except for one and i can't seem to understand why.

I have restarted my pc (it often works xD) and i've also tried exiting and re-entering the session to refresh it.

So basically I have the following code:

<?php
        include "Login-System/db.php";
        session_start();
        $first_name = $_SESSION['first_name'];
        $last_name = $_SESSION['last_name'];
        $email = $_SESSION['email'];
        $active = $_SESSION['active'];
        $user_name = $_SESSION['user_name']; 
?>

The only line not working is this one:

$user_name = $_SESSION['user_name']; 

I have the value in the data_base but I keep getting the notice of variable Undefined.

What I want it to do is basically to show the fetched info from database like the previous code lines but it's just not happening.

0 Answers