0

I am trying to hide a button if it enters a profile with an id that does not correspond to the login, that is, the user, but it does not work, how can I solve it?

 <?php
    if(isset($_GET['id']))
        {
            $id = mysqli_real_escape_string($conexion, $_GET['id']);

            $infouser = mysqli_query($conexion, "SELECT * FROM users WHERE id = $id");  
            $use = mysqli_fetch_array($infouser);
        }
    ?>

<?php

if($_SESSION['id'] = $id)
{
?>
<button class="ml-4" id="edit" data-toggle="modal" data target="#exampleModalCenter">Editar perfil</button>
<?php
}
?>
Mario Ramos García
  • 755
  • 3
  • 8
  • 20

1 Answers1

4

Initially I can see you haven't used the PHP operator for equals correctly, give this a try.

 if($_SESSION['id'] == $id)
Mark
  • 1,852
  • 3
  • 18
  • 31