2014-08-15 18:14
浏览 117


I have this problem, it should be easy to solve. But i'm new to PHP so please help.

The problem is :

Profile page doesn't update after update in mySQL database

For example :
1. User edit their profile (e.g. First Name)
2. Click on update.
3. PHP script to update mySQL runs perfectly.
4. First Name in mySQL updated to the new input.
5. The page redirects to profile page.
6. Problem= The first name is the previous first name.

Users need to log out and sign in again to see their new updated first name.

Here is the code to view the first name in the profile page:

echo '<h1>' . $_SESSION['fname'] . '';

Please help. Thank you.

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

我有这个问题,应该很容易解决。 但我是PHP的新手所以请帮助。


在mySQL中更新后,配置文件页面不会更新 数据库

1。 用户编辑他们的个人资料(例如名字)
2。 点击更新。
3。 用于更新mySQL的PHP​​脚本运行完美。
4。 mySQL中的名字更新为新输入。
5。 该页面重定向到个人资料页面。
6。 问题= 第一个名称是以前的名字。

用户需要退出并重新登录才能看到 他们新更新的名字。


  echo'  &LT; H1&GT;”  。  $ _SESSION ['fname']。  ''; 

请帮忙。 谢谢。

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • donglu4633 2014-08-15 18:19

    The problem is that,you are not reseting $_SESSION['fname']. You should unset that session using unset($_SESSION['fname']); and then set it up again.

    打赏 评论
  • douluo6626 2014-08-15 18:17

    You're not changing the $_SESSION['fname'] when you do the update. It is only set when you do the login. Because of that you will continue to echo out the data from the $_SESSION array until a change is made. Add something to the PHP script that does the database update to update the $_SESSION array.

    打赏 评论

相关推荐 更多相似问题