dougaopu7938 2017-05-19 05:24
浏览 76
已采纳

如何在浏览器和页面刷新后点击按钮后重新更新查询

I was set values in session when user on first page when he click the back button session variables also set with it

if(isset($_SESSION['Seats']))
{
    $Eventid = $_SESSION['Eventid'];
    $stmt = $con->prepare(
        'UPDATE fistevent SET `Status`=" " where `Event_Id`=? AND `seats`=? AND `Status`="Hold" '
    );
    $stmt->bind_param(
         "st",$_SESSION['Eventid'],
          $_SESSION['Seats']
    );
    $stmt->execute();
    session_destroy();
    session_unset();
}

these values are came from other page through POST method

if(isset($_POST['EventId']))
        {
        $Price=mysqli_real_escape_string($con,$_POST['Price']);
        $TicketType=mysqli_real_escape_string($con,$_POST['TicketType']);
        $EventId=mysqli_real_escape_string($con,$_POST['EventId']);
        }
        $stmt = $con->prepare("select * from fistevent WHERE  row_name LIKE 'A%'");
        $stmt->bind_param("s", $_POST['EventId']);
        $stmt->execute();
        $result = $stmt->get_result();
        $numRows = $result->num_rows;
        if($numRows > 0) {
        echo '<ul id="sub" class="sub">';
       while($r = $result->fetch_assoc()) {
**displaying vlaues here came from database**

}
        else
        {
            echo "No seats Available";
        }
  • 写回答

1条回答 默认 最新

  • dongyinzhi4689 2017-05-19 05:28
    关注

    Think about browser caching.

    The back button loads a cache version of the page.

    Try to set with this code, May be it is helpful to you

    <?php
    header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");    // Date in the past
    header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header ("Cache-Control: no-cache, must-revalidate");  // HTTP/1.1
    header ("Pragma: no-cache");
    ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料