<meta charset="utf-8">
<? include_once ('header.htm');?>
<style>
table td{
font-size:36px;
}
img{
display:block;
}
</style>
<?
//分页的函数
function news($pageNum = 1, $pageSize = 3)
{
$array = array();
$con = mysqli_connect("sql208.ccccocccc.cc","vh0_36240789","s19750825","vh0_36240789_1");
mysqli_select_db($con, "vh0_36240789_1");
mysqli_set_charset($con, "utf8");
// limit为约束显示多少条信息,后面有两个参数,第一个为从第几个开始,第二个为长度
$rs = "select * from sx order by sxid desc limit " . (($pageNum - 1) * $pageSize) . "," . $pageSize;
$r = mysqli_query($con, $rs);
while ($obj = mysqli_fetch_object($r)) {
$array[] = $obj;
}
mysqli_free_result($r);
return $array;
}
//显示总页数的函数
function allNews()
{
$con = mysqli_connect("sql208.ccccocccc.cc","vh0_36240789","s19750825","vh0_36240789_1");
mysqli_select_db($con, "vh0_36240789_1");
mysqli_set_charset($con, "utf8");
$rs = "select count(*) num from sx"; //可以显示出总页数
$r = mysqli_query($con, $rs);
$obj = mysqli_fetch_object($r);
/*mysqli_close($con,"vh0_36240789_1");*/
return $obj->num;
}
@$allNum = allNews();
@$pageSize = 6; //约定每页显示几条信息
@$pageNum = empty($_GET["pageNum"])?1:$_GET["pageNum"];
@$endPage = ceil($allNum/$pageSize); //总页数
@$array = news($pageNum,$pageSize);
echo
'<div style="float:left;width:980px;background:#e9e9e9;">';
foreach($array as $key=>$values){
echo
'<div style="float:left;width:940px;margin-top:20px;margin-left:20px;margin-right:20px;background:#fff;">
<div style="float:left;padding-top:10px;padding-left:20px;">
<!--左边开始-->
<table width="380" border="0" style="">
<tbody>
<tr>
<td>姓名:<span>'.$values->sxname.'</span></td>
</tr>
<tr>
<td>来自:<span>'.$values->sxaddress.'</span></td>
</tr>
<tr>
<td>诚心祈祷:</td>
</tr>
<tr>
<td align="left">
<div style="height:244px; overflow:hidden; line-height:50px">
<span class="f12x" style="color:#e60000;word-break:break-all; width:380px; overflow:auto;display:inline-block;text-align:justify;"> '.$values->hxgd.'</span>
</div>
</td>
</tr>
<tr><td>
时间:'.date("Y-m-d",$values->sxshijian).'
</td></tr>
</tbody>
</table>
</div>
<!--左边结束-->
<div style="float:right;">
<table width="500" border="0" cellspacing="0" cellpadding="0" background="img/fobg.jpg" height="418">
<tbody>
<tr>
<td style="padding-left:33px;padding-top:120px;" width="152"><img src="img/sjmnf13.gif" windth="80" height="82" border="0" /></td>
<td>
<div style="margin-left:6px;margin-top:80px;width:201px;height:338px;overflow:hidden;"><img width="201" src="'.$values->sxfoimg.'"/><img width="201" src="'.$values->sxgp.'"/></div></td>
<td style="padding-left:35px;padding-top:120px;" width="152"><img src="img/sjmnf16.gif" windth="83" height="82" border="0"/></td>
</tr>
<tr>
<td align="center" style="" background="img/sjmnf_21.jpg" colspan="3">
<span>'.$values->sxname.'</span></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>';}
?>
</div>
<div style="float:right;width:980px;height:120px;background:#e9e9e9;line-height:120px;text-align:right;padding-right:20px;font-size:46px;">
<a href="?pageNum=1">首页</a>
<a href="?pageNum=<? echo $pageNum==1?1:($pageNum-1)?>">上一页</a>
<a href="?pageNum=<? echo $pageNum==$endPage?$endPage:($pageNum+1)?>">下一页</a>
<a href="?pageNum=<? echo $endPage?>">尾页</a>
</div>
<? include_once ('footer.htm');?>
<? mysqli_close($con,"vh0_36240789_1"); ?>