首页 > 解决方案 > 在加载 SQL 时更改游标

问题描述

我有一个网站,您可以在其中使用 a 在数据库中搜索form,因为数据库非常大,需要一些时间(例如 5 秒),我想将光标更改wait为告诉人们,代码正在搜索和他们不必再次单击提交按钮。问题是我不知道如何仅在站点从数据库中收集所有行时更改光标。

我有一个index.php仅打印的页面,form并且每次更改案例时,它都会调用另一个页面search.php,因此,例如,如果我更改了我的 select 的值form,它将提交form并调用我的另一个 php,该 php 创建一个 SQL 请求和将其查询到我的 SQL Server 数据库。我想更改光标,直到所有行都打印在页面上。

我试过这个search.php

# Gather informations with $_POST[]

# Connect to the database

<div class='pointer'>
if ($co) {
    $stmt = sqlsrv_query($co, $sql, $params, options);
    
    while ($lines=sqsrv_fetch_array($stmt)) {
        # some html code which put every lines in a string
    }

    # print the string with all lines and closethe database
}
</div>

在我的CSS中我有:

.pointer{
    cursor: wait;
}
# Other lines

这不起作用,我需要你的帮助

标签: phpcursor

解决方案


推荐阅读