<link href="css/style.css" rel="stylesheet"> <?php include("conn/conn.php"); %包含数据库连接文件conn.php ?> <table width="563" height="587" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="563" height="587" valign="top" bgcolor="#FFFFFF"><table width="563" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="563" height="27" background="Images/fufei.gif"> </td> </tr> <tr> <td height="96" align="center" valign="top"><br> <?php $date1=date("Y-m-d"); %获取当前年月日 $sgsql=mysql_query("select * from tb_leaguerinfo where type='培训信息' and showday>='$date1' and checkstate=1 "); %查询字符串获取信息 $sginfo=mysql_fetch_array($sgsql); %获取结果 if($sginfo){ do{ ?> <table width="540" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="26"><span class="style1">『培训信息』</span><span class="style8"> <?php echo $sginfo[title];?> </span><span class="style6"> <?php echo $sginfo[edate];?></span></td> </tr> <tr> <td height="26"> <span class="style5"> <?php echo $sginfo[content];?></span></td> </tr> <tr> <td height="26"> <span class="style8">联系人:<?php echo $sginfo[linkman];?> 联系电话:<?php echo $sginfo[tel];?></span></td> </tr> <tr> <td height="3" background="Images/line1.gif"></td> </tr> </table> <?php }while($sginfo=mysql_fetch_array($sgsql)); %展示这些信息 }else{ ?> <table width="540" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center">暂无培训信息资源!</td> </tr> </table> <?php } ?></td> </tr> <tr> <td align="center" valign="top"><table width="560" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="87" background="Images/guanggao.gif"> </td> </tr> </table></td> </tr> <tr> <td height="27" background="Images/mian.gif"> </td> </tr> <tr> <td height="140" align="center" valign="top"> <br> <?php date_default_timezone_set("Asia/Hong_Kong"); %设置时区为香港时区 $sql=mysql_query("select count(*) as total from tb_info where type='培训信息' and checkstate=1"); %查询字符串,获取结果总数 $info=mysql_fetch_array($sql); %获取结果 $total=$info[total]; %获取结果数 $pagesize=4; if ($total<=$pagesize){ $pagecount=1; %若结果数小于页面数,则页面数为1 } if(($total%$pagesize)!=0){ $pagecount=intval($total/$pagesize)+1; %若total不能整除pagesize,则在结果的基础上加1 }else{ $pagecount=$total/$pagesize; %否则直接取结果 } if(($_GET[page])==""){ $page=1; %默认为第一页 }else{ $page=intval($_GET[page]); %获取url中的页数 } $gsql=mysql_query("select * from tb_info where type='培训信息' and checkstate=1 order by edate desc limit ".($page-1)*$pagesize.",$pagesize"); %查询字符串 $ginfo=mysql_fetch_array($gsql); %获取结果 if($ginfo){ do{ ?> <table width="540" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="26"><span class="style1">『培训信息』</span><span class="style8"> <?php echo $ginfo[title];?> </span><span class="style6"> <?php echo $ginfo[edate];?></span></td> </tr> <tr> <td height="26"> <span class="style5"> <?php echo $ginfo[content];?></span></td> </tr> <tr> <td height="26"> <span class="style8">联系人:<?php echo $ginfo[linkman];?> 联系电话:<?php echo $ginfo[tel];?></span></td> </tr> <tr> <td height="3" background="Images/line1.gif"></td> </tr> </table> <?php }while($ginfo=mysql_fetch_array($gsql)); %展示结果 ?> <table width="543" height="27" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="543" height="27" colspan="3" align="right"> 共有 <?php echo $total; ?> 条 每页显示 <?php echo $pagesize;?> 条 第 <?php echo $page;?> 页/共 <?php echo $pagecount; ?> 页 <?php if($page>=2) { ?> <a href="foster.php?page=1" title="首页"></a><a href="foster.php?page=<?php echo $page-1;?>" title="前一页"> <?php } if($pagecount<=4){ for($i=1;$i<=$pagecount;$i++){ ?> <a href="foster.php?page=<?php echo $i;?>"><?php echo $i;?></a> <?php } }else{ for($i=1;$i<=4;$i++){ ?> <a href="foster.php?page=<?php echo $i;?>"><?php echo $i;?></a> <?php }?> <a href="foster.php?page=<?php echo $page-1;?>" title="后一页"></a> <a href="foster.php?page=<?php echo $pagecount;?>" title="尾页"></a> %设置前进、后退页 <?php }?></td> </tr> </table> <?php } else{ ?> <table width="540" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center">暂无培训信息资源!</td> </tr> </table> <?php } ?> </td> </tr> </table> </td> </tr> </table> <meta http-equiv="Content-Type" content="text/html; charset=gb2312">