0
我有一個按鈕:PHP報告MSSQL查詢表的狀況選擇進入
<a href="#" onclick="loadPage('admin_manualsend.php?refresh=true'); return false;">
<i class="fa fa-refresh"></i> 1. Refresh Now
</a>
,並點擊它加載在同一頁它是一個與刷新= true,所以現在當它觸發此頁面加載:
if(isset($_GET["refresh"]) && $_GET["refresh"]=="true"){
$res = db_query("begin try drop table [TmpTable] end try begin catch end catch");
$res = db_query("SELECT * INTO [TmpTable] FROM [dbo].[ViewLive]");
}
這需要一段時間,我想它報告表下降是成功還是失敗,同時報告其記錄它現在轉移的數量,然後當它完成所以是這樣的:
if(isset($_GET["refresh"]) && $_GET["refresh"]=="true"){
$res = db_query("begin try drop table [TmpTable] end try begin catch end catch");
Show modal, echo 'Drop done'; (or drop failed)
WHILE ($res = db_query("SELECT * INTO [TmpTable] FROM [dbo].[ViewLive]");
echo 'Count of current record'
count of record +1
)
echo 'Update done';
(user can then close modal)
}
我該怎麼做?我使用PHP,MSSQL,SCRIPT SRC = 「// ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js」>
謝謝
更新:
function db_query($query) {
global $conn;
$res = sqlsrv_query($conn, $query);
return $res;
}
function db_fetch_array($res) {
$result = array();
while($array = sqlsrv_fetch_array($res)) {
$result[count($result)] = $array;
}
sqlsrv_free_stmt($res);
return $result;
}
function db_fetch_row($res) {
$array = sqlsrv_fetch_array($res);
sqlsrv_free_stmt($res);
return $array;
}
function db_fetch_one($res) {
$array = sqlsrv_fetch_array($res);
sqlsrv_free_stmt($res);
return $array[0];
其中爲'loadPage()'的代碼? – CodeGodie
@CodeGodie我不確定你的意思是對不起。可能是這個,我在帖子的更新中加入:) – SSS
我的意思是你的'''標籤中的函數,在這裏:'onclick =「loadPage('admin_manualsend.php?refresh = true');'這就是尋找一個名爲'loadPage()'的JS函數,我想知道那些代碼在做什麼,你可以發佈這個函數嗎? – CodeGodie