dq804806 2018-08-17 09:28
浏览 85
已采纳

PHP会话不更新变量

I'm building an image slider where images are loaded from my database and displayed inside a php page.

There's a session variable, "number", to remember what is the current database row, in this way I can easily move to next or previous image.

Initially the page was working perfectly, but now when I press on "Next" button to increase session number and move to next page, it remains stuck to "2" and doesn't allow me to read other pages, even if there are multiple ones. I can only browse image no. 1 and image no. 2

I believe the code is correct, but I'm afraid there's something missing about how PHP sessions works, can you confirm it?

//

  • 写回答

2条回答 默认 最新

  • doupo5861 2018-08-17 09:55
    关注

    session_start() must be the second thing on your page after <?php. HTML tags must be placed after it or the session will not be started.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?