dqj5046 2016-06-02 17:41
浏览 18

网站在首次刷新时不更新内容

On my website I'm listing data from the database with the use of $query->fetch(PDO::FETCH_ASSOC);. Everything is working fine except that after changing the database and redirecting with header() the user must refresh the page again to actually see the changes. I don't know what is causing this and it seems odd that the content is there but only upon a second refresh. Any help would be great. Thanks.

This is the code that is listing data back to the user.

public function getCoilInfo ($coil_id) {
    //Database Connection
    $db = Database::getInstance();

    //Query to select all information from `coils` tables based off $coil_id
    $query = $db->getConnection()->prepare("SELECT * FROM `coils` WHERE coil_id = :coil_id");
    $query->execute(array(
        ':coil_id' => $coil_id
    ));

    //Return array with results
    return $query->fetch(PDO::FETCH_ASSOC);
}

I then reference the following class like this:

$coil = new Coil();
$coilInfo = $coil->getCoilInfo($_GET['coil_id']);

echo $coilInfo['coil_name'];
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 keil的map文件中Image component sizes各项意思
    • ¥15 BC260Y用MQTT向阿里云发布主题消息一直错误
    • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
    • ¥15 划分vlan后,链路不通了?
    • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 Centos / PETGEM
    • ¥15 划分vlan后不通了
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)