ช่วยดูโค๊ตให้หน่อยครับ เกี่ยวกับ innerhtml พอดีว่าผมอยากให้มันดึงข้อมูลใหม่มาโชทุก 10 วินาทีอะครับแต่มันดันไม่ดึงมา<br /> แสดงอะครับ และไม่มี error ใน JavaScript ด้วยอะครั
พอดีว่าผมอยากให้มันดึงข้อมูลใหม่มาโชทุก 10 วินาทีอะครับแต่มันดันไม่ดึงมา
แสดงอะครับ และไม่มี error ใน JavaScript ด้วยอะครับ
<?php require_once("lib.db.php"); ?>
<?php require_once("lib.sess.php"); ?>
<?php require_once("lib.datetime.php"); ?>
<?php require_once("lib.perms.php"); ?>
<?php //require_once("lib.mustlogin.php"); ?>
<?php require_once("lib.report.php"); ?>
<? $i = 0;?>
<?php pageperm()?>
<?
$jobid = reqvar("jobid") + 0 ;
$showall = reqvar("showall") + 0;
$sort = " order by t.batchid DESC ,txnseq DESC ,t.pan ASC";
$rowtop = getcfg("RECENT TRANSACTION LIST SIZE",50);
$batchid = "";
$txnid = "";
$payid = "";
$amt = "";
$txnseq = "";
$invoice = "";
$respcode = "";
$merid = "";;
$cardno = "";
$termid = "";
$i =0;
$found = false;
$sql = "select top ".$rowtop." t.txnid ,t.batchid,t. txnseq, t.jobid ,t.pan as cardno, t.merid,t.termid ,t.voided , t.blocked,
t.respcode, t.processed , m.mername,t. invoice, t.amt, t.payid , t.respcode from txn t inner join mer m on t.merid = m.merid ";
if($showall == "0"){
$where = " where jobid = '".$jobid."' and respcode <> '00' and (respcode <> null or respcode <> '' or respcode is not null ) ";
}else{
$where = " where jobid = '".$jobid."' and (respcode <> null or respcode <> '' or respcode is not null ) ";
}
//$where = " where jobid = '".$jobid."'";
$sql = $sql.$where.$sort;
//debug($sql2);
$rs = sqlquery($sql);
//debug($rs);
?>
<html>
<head>
<title>Merchant Report</title>
<Script Language="JavaScript" src=lib.utils.js.php></script>
<link href="lib.rps.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<script language="JavaScript" src="function/calendar.js"></script>
<link href="function/calendar-mos.css" rel="stylesheet" type="text/css">
</head>
<body topmargin="0" onload="a();">
<script>
var MAXROWS = <?=$rowtop;?>;
var TABLEHEAD = "<table cellpadding=1px cellspacing=0 border=1px style=\"border: 1px solid #20085d;\" align=center><tr class=\"tableHeader2\">";
TABLEHEAD = TABLEHEAD + "<td align=center style=\"width:20px;\" nowrap >Batch ID</td><td align=center style=\"width:20px;\" nowrap >";
TABLEHEAD = TABLEHEAD + "TXN Seq. </td> <td align=center style=\"width:100px;\"> Card No</td><td align=center style=\"width:100px;\">";
TABLEHEAD = TABLEHEAD + "Terminal id</td> <td align=center style=\"width:100px;\">Payment id</td><td align=center style=\"width:100px;\" >";
TABLEHEAD = TABLEHEAD + "Amount </td> <td align=center style=\"width:100px;\">Invoice</td><td align=center style=\"width:50px;\">Resp. Code</td></tr>";
var rows = new Array(MAXROWS);
for (var i = 0; i < MAXROWS; i++)
{
// make all elements defined
rows = "";
}
var rnd1 = "", rnd2 = "";
<?
if($rs){
while($row = sqlfetch($rs)){
$found = true;
$batchid = $row["batchid"];
$txnid = $row["txnid"];
$payid = $row["payid"];
$amt = $row["amt"];
$txnseq = $row["txnseq"];
$invoice = $row["invoice"];
$respcode = $row["respcode"];
$merid = $row["merid"];
$cardno = $row["cardno"];
$termid = $row["termid"];
?>
rows[<?=$i?>] = "<tr class=cellContent onMouseOver=\"this.className = 'cellContent2 hand'\" onMouseOut=\"this.className = 'cellContent hand'\"><td align=right><?=$batchid?> </td><td align=\"right\"><?=number_format($txnseq)?></td><td align=left><?=$cardno?> </td><td align=left><?=$termid?> </td><td align=left><?=$payid?></td><td align=right><?=number_format($amt,2)?></td><td align=left><?=invoicelength($invoice)?> </td><td align=center><?=$respcode?> </td></tr>";
<?
$i++;
}
}
if(!$found){
?>
rows[0] = "<tr><td colspan=8 class=msg > No Found Transections</td>";
<?
}
?>
function writetable()
{
var tblholder = document.getElementById("tblholder");
var html = TABLEHEAD;
for (var i = 0; i < MAXROWS; i++)
{
if (rows == "")
break;
html += rows;
}
html += "</table>";
tblholder.innerHTML = html;
}
function randomizerows()
{
<?
$sql = "select top ".$rowtop." t.txnid ,t.batchid,t. txnseq, t.jobid ,t.pan as cardno, t.merid,t.termid ,t.voided , t.blocked,
t.respcode, t.processed , m.mername,t. invoice, t.amt, t.payid , t.respcode from txn t inner join mer m on t.merid = m.merid ";
if($showall == "0"){
$where = " where jobid = '".$jobid."' and respcode <> '00' and (respcode <> null or respcode <> '' or respcode is not null ) ";
}else{
$where = " where jobid = '".$jobid."' and (respcode <> null or respcode <> '' or respcode is not null ) ";
}
$sql = $sql.$where.$sort;
$rs2 = sqlquery($sql);
$j=0;
if($rs2){
while($row2 = sqlfetch($rs2)){
$batchid = $row2["batchid"];
$txnid = $row2["txnid"];
$payid = $row2["payid"];
$amt = $row2["amt"];
$txnseq = $row2["txnseq"];
$invoice = $row2["invoice"];
$respcode = $row2["respcode"];
$merid = $row2["merid"];
$cardno = $row2["cardno"];
$termid = $row2["termid"];
?>
rows[<?=$j?>] = "<tr class=cellContent onMouseOver=\"this.className = 'cellContent2 hand'\" onMouseOut=\"this.className = 'cellContent hand'\"><td align=right><?=$batchid?> </td><td align=\"right\"><?=number_format($txnseq)?></td><td align=left><?=$cardno?> </td><td align=left><?=$termid?> </td><td align=left><?=$payid?></td><td align=right><?=number_format($amt,2)?></td><td align=left><?=invoicelength($invoice)?> </td><td align=center><?=$respcode?> </td></tr>";
<?
$j++;
}
}
?>
writetable();
a();
}
</script>
<body>
<?
debug($sql);
?>
<span id=tblholder></span>
</body>
<script>
writetable();
</script>
</body>
<script>
var re;
function a(){
clearTimeout(re);
re = setTimeout("randomizerows();" ,2000);
}
</script>
</html>Tag : - - - -
Date :
8 ก.ค. 2551 09:46:10
By :
windersun
View :
1314
Reply :
1
ใช้ AJAX จะง่ายกว่ามั๊ย
Date :
8 ก.ค. 2551 18:59:45
By :
Apache
Load balance : Server 00