-1

I am trying to figure out this issue I am having.

I am trying to create a link but ONLY if there's an admin logged in, otherwise the link should be hidden.

if ($administrator = true) {
            echo '<a href="medewerkertoevoegen.php?id='.'">Medewerkers 
toevoegen</a>';
        }
        else 
    {
       echo '<span></span>'; 
    }

I am not sure if this is how it should work, currently my database looks like this. https://i.stack.imgur.com/fob2O.png

Please let me know if you can help me because I am very new at this, thanks!

Tom Kik
  • 1
  • 2

1 Answers1

0

Because '=' is assignation (not comparing). You must use '==' or '==='.

if ($administrator === true) {
    echo '<a href="medewerkertoevoegen.php?id='.'">Medewerkers 
toevoegen</a>';
} else {
    echo '<span></span>'; 
}
Neodan
  • 5,154
  • 2
  • 27
  • 38