dtvdz911959
2017-12-05 20:56
浏览 60
已采纳

PHP:用户成功注销但在注销刷新主页后显示未定义的变量:

Email is the user session email after successfully logout there is no email exist but on index page is shows undefined index as there is no email after logout.

Notice: Undefined index: email in C:\xampp\htdocs\CMS\index.php on line 9
    <?session_start();
?>
<?php
    require("conection/connect.php");   
    $username=$_SESSION['email'];
    $sel= "select * from users where email= '$username'";
    $run_name = mysqli_query($con, $sel);
    $row_user=mysqli_fetch_array($run_name);
    $name=$row_user['name'];
    $userid=$row_user['user_id'];
    $teacherid=$row_user['teacher_id'];
    $userid=$row_user['stu_id'];
    $usertype=$row_user['type'];
?>

图片转代码服务由CSDN问答提供 功能建议

电子邮件是成功注销后的用户会话电子邮件,不存在电子邮件,但索引页面上显示未定义的索引,因为那里 注销后没有电子邮件。

 注意:未定义的索引:第9行的C:\ xampp \ htdocs \ CMS \ index.php中的电子邮件
&lt;?session_start()  ; 
?&gt; 
&lt;?php 
 require(“conection / connect.php”);  
 $ username = $ _ SESSION ['email']; 
 $ sel =“select * from users where email ='$ username'”; 
 $ run_name = mysqli_query($ con,$ sel); 
 $ row_user  = mysqli_fetch_array($ run_name); 
 $ name = $ row_user ['name']; 
 $ userid = $ row_user ['user_id']; 
 $ teacherid = $ row_user ['teacher_id']; 
 $ userid  = $ row_user ['stu_id']; 
 $ usertype = $ row_user ['type']; 
?&gt; 
   
 
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题