doujumiao5024 2018-05-01 11:24
浏览 13
已采纳

如果它与会话的ID不对应,我怎么能用php隐藏一个按钮? [重复]

This question already has an answer here:

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
}
?>
</div>
  • 写回答

1条回答 默认 最新

  • dongsuichi6529 2018-05-01 11:25
    关注

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

     if($_SESSION['id'] == $id)
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 有没有帮写代码做实验仿真的
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?