21,886
社区成员
发帖
与我相关
我的任务
分享
while($field=mysql_fetch_field($result))
{
echo"<td>".$field->name."</td>\n";
$str= $str.$field->name.",";
}
//用mysql_fetch_row()试试 打印$field看看有没有数据
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>店面营业查询结果</title>
<style type="text/css">
<!--
.style2 {font-size: 14px}
-->
</style>
</head>
<body>
<span class="style2">
<?
$top=$_POST["d_s"];
$end=$_POST["d_e"];
$data=$_POST["shujuku"];
echo "$data.$end.$top";
echo "您所查询的数据是:";
echo " $top";
echo "到 ";
echo "$end ";
echo "之间的全部数据 ";
echo "\r<a href='javascript:onclick=history.go(-1)'>返回上页</a> ";
echo "<form action=\"searchdc.php\" method=\"post\">";
echo "<input name=\"top\" type=\"hidden\" value=\"$top\">";
echo "<input name=\"end\" type=\"hidden\" value=\"$end\">";
echo "<input name=\"dmmc\" type=\"hidden\" value=\"$data\">";
echo "<input type=\"submit\" name=\"Submit\" value=\"导出Excel表\">";
echo "</form>";
$link=mysql_connect("192.168.3.221","root","myoa888");
$今天 =date("Y-m-d");
mysql_query("use klserver"); //mysql_select_db("ttserver");
$result=mysql_query("SELECT 日期,网费收入,会员收入,商品收入,点卡收入,网费收入+会员收入+商品收入+点卡收入 AS 合计 FROM ".$data." ",$link);
echo "<table border=1>\n";
echo"<tr>\n";
while($field=mysql_fetch_field($result)){
echo"<td>".$field->name."</td>\n";
$str= $str.$field->name.",";
}
//生成新的查询字段
$length=strlen($str);
$sumstr=substr($str, 0, $length-1);
echo $sumstr;
echo "</tr>\n";
mysql_free_result($result);
$result=mysql_query("SELECT $sumstr FROM $data where 日期 between '$top' and '$end'" ,$link);
while($row = mysql_fetch_row($result)) {
echo "<tr>\n";
for($i=0;$i<count($row);$i++){
echo "<td>".$row[$i]."</td>";
}
echo "</tr>\n";
}
echo "</table>\n";
mysql_free_result($result);
mysql_close($link);
?>
</span>
</body>
</html>
<?php
$pageTitle = "Test Log Summary"; //定义页面标头
include_once './global.php'; //链接全局配置
//获取测试记录最后更新时间
$query = $db->select("bp_testloglist", "testEndtime", "order by testEndtime desc limit 0,1");
if ($row = $db->fetch_array($query)) {
$lastUpdateint = $row['0'] + 54000;
}
unset($query);
unset($row);
$lastUpdatedayint = strtotime(date("Y-m-d",$lastUpdateint)); //依据dell时间换成当天的开始时间int
//依据测试记录最后时间变成abc时间
$queryDateint = $lastUpdatedayint - 6* 24 * 60 * 60-54000;
//获取最后2天的测试时间
$queryDateint2 = $lastUpdatedayint - 24 * 60 * 60- 54000;
$querDateabc2int = $queryDateint2+54000;
//获得测试工站的Performance
$query = $db->select("bp_testloglist", "testStation,testResult, testEndtime", "where testEndtime>=$queryDateint and testDatabase=0");
while ($row = $db->fetch_array($query)) {
$stationSummary[dellToabcdayint($row['2'])][$row['0']][$row['1']] = $stationSummary[dellToabcdayint($row['2'])][$row['0']][$row['1']] + 1;
}
unset($query);
unset($row);
$m_Testhate = $m_Testhate + 24 * 60 * 60;
//获取测试工站名称
$query = $db->query("select a.testerFullname,a.testerID,a.testerType,b.stationNamelite,a.testerName,INET_NTOA(a.testerIP) from bp_tester as a left join bp_teststation as b on a.testerType = b. stationID where a.testerShow=1 order by a.testerType, testerFullname asc");
while ($row = $db->fetch_array($query)) {
$testType[$row['2']] = $row['3'];
$testerHost[$row['1']] = array('testerHost' => $row[4], 'testerIP' => $row['5'], 'testerStation' => $row['3']);
$testerName[$row['1']] = $row['0'];
$i++;
}
unset($query);
unset($row);
$currentTime = date("Y-m-d H:i:s");
include_once './include/system.top.php';
include_once './include/system.menu.php';
?>
<ul class="tabs left">
<li><a href="#tester">TESTER</a></li>
</ul>
<div id="tester" class="tab-content">
<h5>[ Test Station Performance ]_UPDATE: [ <FONT COLOR='RED'><?PHP ECHO $currentTime; ?></FONT> ]</h5>
<table class="sortable">
<thead>
<tr>
<th colspan="2" rowspan ="2" class="center">Tester / Date</th>
<?php
$a = $queryDateint + 54000;
$i = 0;
for ($a; $a <= $lastUpdateint; $a = $a + 24 * 60 * 60) {
$testDate[$i] = $a;
echo "<th colspan='4' class='center'>" . date("Y-m-d", $a) . "<br>" . date("l", $a) . "</th>";
$i++;
}
unset($a);
?>
</tr>
<tr>
<?php
for ($a = 0; $a < $i; $a++) {
?>
<th class="center">T</th>
<th class="center">P</th>
<th class="center">F</th>
<th class="center">A</th>
<?php
}
?>
</tr>
</thead>
<tbody>
<?php
if (!empty($testerHost)) {
foreach ($testerHost as $key => $value1) {
$testerID = $key;
?>
<tr>
<td title="<?php echo $value1['testerStation'] . "=>HOST NAME: " . $value1['testerHost']; ?>" ><?php echo $testerName[$key]; ?></td>
<td><?php echo $value1['testerIP']; ?></td>
<?php
foreach ($testDate as $value) {
@$totalPass[$value] > 0 ? @$totalPass[$value] : @$totalPass[$value] = 0;
@$totalFail[$value] > 0 ? @$totalFail[$value] : @$totalFail[$value] = 0;
@$totalAbort[$value] > 0 ? @$totalAbort[$value] : @$totalAbort[$value] = 0;
@$totalTotal[$value] > 0 ? @$totalTotal[$value] : @$totalTotal[$value] = 0;
if (arrayValue($stationSummary, $value)) {
if (arrayValue($stationSummary[$value], $testerID)) {
$tPass = (int) arrayValue($stationSummary[$value][$testerID], '3');
$tFail = (int) arrayValue($stationSummary[$value][$testerID], '1');
$tAbort = (int) arrayValue($stationSummary[$value][$testerID], '2');
$tTotal = $tPass + $tFail + $tAbort;
$totalPass[$value] = $totalPass[$value] + $tPass;
$totalFail[$value] = $totalFail[$value] + $tFail;
$totalAbort[$value] = $totalAbort[$value] + $tAbort;
$totalTotal[$value] = $totalTotal[$value] + $tTotal;
} else {
$tPass = 0;
$tFail = 0;
$tAbort = 0;
$tTotal = $tPass + $tFail + $tAbort;
$totalPass[$value] = $totalPass[$value] + $tPass;
$totalFail[$value] = $totalFail[$value] + $tFail;
$totalAbort[$value] = $totalAbort[$value] + $tAbort;
$totalTotal[$value] = $totalTotal[$value] + $tTotal;
}
} else {
$tPass = 0;
$tFail = 0;
$tAbort = 0;
$tTotal = $tPass + $tFail + $tAbort;
$totalPass[$value] = $totalPass[$value] + $tPass;
$totalFail[$value] = $totalFail[$value] + $tFail;
$totalAbort[$value] = $totalAbort[$value] + $tAbort;
$totalTotal[$value] = $totalTotal[$value] + $tTotal;
}
if ($tTotal <> 0) {
echo "<td class='center'><a href='tldetail.php?testDate=" . $value. "&testStation=$testerID' >$tTotal</a></td>";
} else {
echo "<td></td>";
}
if ($tPass <> 0) {
echo "<td class='center'><a href='tldetail.php?testDate=" . $value. "&testStation=$testerID&testResult=3' ><font color='green'>$tPass</font></a></td>";
} else {
echo "<td></td>";
}
if ($tFail <> 0) {
echo "<td class='center'><a href='tldetail.php?testDate=" . $value. "&testStation=$testerID&testResult=1' ><font color='Red'>$tFail</font></a></td>";
} else {
echo "<td></td>";
}
if ($tAbort <> 0) {
echo "<td class='center'><a href='tldetail.php?testDate=" . $value. "&testStation=$testerID&testResult=2' ><font color='orange'>$tAbort</font></a></td>";
} else {
echo "<td></td>";
}
}
?>
</tr>
<?php
}
}
?>
<tr>
<th colspan ="2" class="center">Total</th>
<?php
foreach ($testDate as $value) {
if ($totalTotal[$value] <> 0) {
echo "<th class='center'><a href='tldetail.php?testDate=" . $value. "' >$totalTotal[$value]</a></th>";
} else {
echo "<th></th>";
}
if ($totalPass[$value] <> 0) {
echo "<th class='center'><a href='tldetail.php?testDate=" . $value . "&testResult=3' ><font color='green'>$totalPass[$value]</font></a></th>";
} else {
echo "<th></th>";
}
if ($totalFail[$value] <> 0) {
echo "<td class='center'><a href='tldetail.php?testDate=" . $value . "&testResult=1' ><font color='Red'>$totalFail[$value]</font></a></th>";
} else {
echo "<th></th>";
}
if ($totalAbort[$value] <> 0) {
echo "<th class='center'><a href='tldetail.php?testDate=" . $value. "&testResult=2' ><font color='orange'>$totalAbort[$value]</font></a></th>";
} else {
echo "<th></th>";
}
}
$totalTotal = NULL;
$totalPass = NULL;
$totalFail = NULL;
$totalAbort = NULL;
?>
</tr>
</tbody>
</table>
</div>
<?php include_once './include/system.boot.php'; ?>