在线等!!!急急急!请高手多多关照!!:-)
$dbh=mysql_connect('****','****','*****');
if(!$dbh)
{
echo "没连接到数据库".strval($dbh);
exit;
}
$query="select newsdate,edition,count(*)
from record,rec_user
where ru_iuser='".$_SESSION["logname"]."'
and date_format(ru_idate,'%m %d, %y')='".$strDate."'
and ru_id=recid
group by newsdate,edition
order by newsdate,edition";
$rsh=mysql_db_query('paper',$query,$dbh);
if (!($row==false))
{
print "<th>序号</th>";
print "<th>报纸日期</th>";
print "<th>所属版面</th>";
print "<th>标著总数</th>";
$index=0;
$totPap=0;
$totSum=0;
$strOld="";
while(!($row==0))
{
$index=$index+1;
print "<tr>";
print "<td>".$index."</td>";//序号
$strTmp=(0).$Value;
print "<td>".$strTmp."</td>";//报纸日期
if ($strTmp!=$strOld)
{
$totPap=$totPap+1;
$strOld=$strTmp;
}
$strTmp=(1).$Value;
print "<td>第 ".$strTmp." 版</td>";//所属版面
$strTmp=(2).$Value;
print "<td>".$strTmp." 条</td>";//标著总数
$totSum=$totSum+intval($strTmp);
print "</tr>";
$row=mysql_fetch_array($rsh);
}
print "<tr>";
print "<td><b>统计</b></td>";
print "<td>共 ".$totPap." 期</td>";
print "<td>总 ".$index." 版</td>";
print "<td>共 ".$totSum." 条</td>";
print "</tr>";
}
else
{
print "无数据";
}
?>