Mysql select doesn't work as i hoped

i have a code but it doesn’t work it should show admin page when i loged in with a admin accout but that doesn’t work

$servername = "localhost";
$username = "id5514567_treinenboy12";
$password = "*******";
$dbname = "id5514567_treinenboy12";

$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

        
        

        $sql = "SELECT * FROM `Users` WHERE `userType`=Admin AND `userLoginNaan`=".$_SESSION["user"];

        $result = $conn->query($sql);
        if ($result->num_rows > 0) {
                    
                    echo '<a href="/admin">Admin Pagina</a>';
               
            }

session start is on top of the page that is not the problem

What do i wrong

1 Like

Are you sure the session is set?

yes and i change something(i don’t now which section) but it works now

2 Likes