<?php
session_start();
include ("conn.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>管理新闻</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body,td,th {
font-size: 14px;
color: #999999;
font-family: 宋体;
}
a:link {
text-decoration: none;
color: #FF0000;
}
a:visited {
text-decoration: none;
color: #FF0000;
}
a:hover {
text-decoration: none;
color: #FFCC00;
}
a:active {
text-decoration: none;
}
body {
background-image: url(img/h_bj.jpg);
background-repeat: no-repeat;
}
.STYLE1 {color: #FF0000}
-->
</style><body ><TABLE width="700" cellPadding=0 cellSpacing=0 >
<TBODY>
<b><a href="add_news.php" class="STYLE1">[发布新闻]</a></b>
<tr>
<table width="700" height="500" align="center" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="130" align="center" valign="top" ><?php if ($page=="") {$page=1;}; ?>
<table width="700" border="0" align="center" cellpadding="3" >
<?php
if ($page){
$page_size=15; //每页显示20条记录
$query="select count(*) as total from news"; //查询数据库所有记录
$result=mysql_query($query); //查询总的记录条数
$message_count=mysql_result($result,0,"total"); //为变量赋值
$page_count=ceil($message_count/$page_size); //根据记录总数除以每页显示的记录数求出所分的页数
$offset=($page-1)*$page_size; //计算下一页从第几条数据开始循环
$sql=mysql_query("select * from news order by id desc limit $offset, $page_size");
$info=mysql_fetch_array($sql);
?>
<tr>
<td height="30" align="center" valign="top" >
<table width="650" border="0" cellspacing="0" cellpadding="0" >
<tr><td height="5"></td>
</tr>
<tr>
<td>
<h3>新闻管理</h3>
</td>
</tr>
<tr>
<td >
<table width="620" border="1" cellspacing="0" cellpadding="0" valign="top" >
<tr>
<td width="75%" align="center">
新闻标题
</td>
<td width="15%">
发布时间
</td>
<td width="10%" align="center">
操作
</td>
</tr>
<?php
if($info){
$i=1;
do{
?>
<tr>
<td width="70%" align="left" valign="top">
<a href="showmanager_news.php?id=<?php echo $info[id];?>" title="查看新闻">
<?php echo $i."、 ".$info[title];?></a></td>
<td width="20%" align="center" ><?php echo$info[now];?></td>
<td width="!0%" align="center"><a href="del_news.php?id=<?php echo $info[id];?>">
<!--删除新闻 -->
<img src="../Admin/img/A_delete.gif" width="52" height="16" onclick="javascript:if (confirm('您确定要删除吗?注意:此操作不可恢复,请谨慎操作!')){return true;} return false;" border="0"></a></td>
</tr>
<?php
$i=$i+1;
}while($info=mysql_fetch_array($sql))
?>
</table>
</td>
</tr>
</table></td>
</tr>
<?php } ?>
</table>
<table width="650" border="0" align="center" cellpadding="0" cellspacing="0">
<tr align="left">
<td width="50%"> 页次:<?php echo $page;?>/<?php echo $page_count;?>页 记录:<?php echo $message_count;?> 条</td>
<td width="50%" align="right">
<?php
if($page!=1)
{
echo "<a href=manager_news.php?page=1>首页</a> ";
echo "<a href=manager_news.php?page=".($page-1).">上一页</a> ";
}
if($page<$page_count)
{
echo "<a href=manager_news.php?page=".($page+1).">下一页</a> ";
echo "<a href=manager_news.php?page=".$page_count.">尾页</a>";
}
}
?>
</td>
</tr>
</table></td>
</tr>
</table>
</table></TD>
</TR>
</TBODY>
</TABLE>
</body>
</html>
session_start();
include ("conn.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>管理新闻</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body,td,th {
font-size: 14px;
color: #999999;
font-family: 宋体;
}
a:link {
text-decoration: none;
color: #FF0000;
}
a:visited {
text-decoration: none;
color: #FF0000;
}
a:hover {
text-decoration: none;
color: #FFCC00;
}
a:active {
text-decoration: none;
}
body {
background-image: url(img/h_bj.jpg);
background-repeat: no-repeat;
}
.STYLE1 {color: #FF0000}
-->
</style><body ><TABLE width="700" cellPadding=0 cellSpacing=0 >
<TBODY>
<b><a href="add_news.php" class="STYLE1">[发布新闻]</a></b>
<tr>
<table width="700" height="500" align="center" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="130" align="center" valign="top" ><?php if ($page=="") {$page=1;}; ?>
<table width="700" border="0" align="center" cellpadding="3" >
<?php
if ($page){
$page_size=15; //每页显示20条记录
$query="select count(*) as total from news"; //查询数据库所有记录
$result=mysql_query($query); //查询总的记录条数
$message_count=mysql_result($result,0,"total"); //为变量赋值
$page_count=ceil($message_count/$page_size); //根据记录总数除以每页显示的记录数求出所分的页数
$offset=($page-1)*$page_size; //计算下一页从第几条数据开始循环
$sql=mysql_query("select * from news order by id desc limit $offset, $page_size");
$info=mysql_fetch_array($sql);
?>
<tr>
<td height="30" align="center" valign="top" >
<table width="650" border="0" cellspacing="0" cellpadding="0" >
<tr><td height="5"></td>
</tr>
<tr>
<td>
<h3>新闻管理</h3>
</td>
</tr>
<tr>
<td >
<table width="620" border="1" cellspacing="0" cellpadding="0" valign="top" >
<tr>
<td width="75%" align="center">
新闻标题
</td>
<td width="15%">
发布时间
</td>
<td width="10%" align="center">
操作
</td>
</tr>
<?php
if($info){
$i=1;
do{
?>
<tr>
<td width="70%" align="left" valign="top">
<a href="showmanager_news.php?id=<?php echo $info[id];?>" title="查看新闻">
<?php echo $i."、 ".$info[title];?></a></td>
<td width="20%" align="center" ><?php echo$info[now];?></td>
<td width="!0%" align="center"><a href="del_news.php?id=<?php echo $info[id];?>">
<!--删除新闻 -->
<img src="../Admin/img/A_delete.gif" width="52" height="16" onclick="javascript:if (confirm('您确定要删除吗?注意:此操作不可恢复,请谨慎操作!')){return true;} return false;" border="0"></a></td>
</tr>
<?php
$i=$i+1;
}while($info=mysql_fetch_array($sql))
?>
</table>
</td>
</tr>
</table></td>
</tr>
<?php } ?>
</table>
<table width="650" border="0" align="center" cellpadding="0" cellspacing="0">
<tr align="left">
<td width="50%"> 页次:<?php echo $page;?>/<?php echo $page_count;?>页 记录:<?php echo $message_count;?> 条</td>
<td width="50%" align="right">
<?php
if($page!=1)
{
echo "<a href=manager_news.php?page=1>首页</a> ";
echo "<a href=manager_news.php?page=".($page-1).">上一页</a> ";
}
if($page<$page_count)
{
echo "<a href=manager_news.php?page=".($page+1).">下一页</a> ";
echo "<a href=manager_news.php?page=".$page_count.">尾页</a>";
}
}
?>
</td>
</tr>
</table></td>
</tr>
</table>
</table></TD>
</TR>
</TBODY>
</TABLE>
</body>
</html>
解决方案 »
- 怎么讲二维数组写入txt文件
- 请教,php怎么读取mysql二级分类?高人帮我看下
- 启动Apache时说php_mysql.dll找不到指定路径
- utf-8编码,js设置的cookie,用php读取时中文乱码
- 请问怎么把一个jpg处理成一个缩略图
- 关于目录权限修改为777后回产生的安全问题的讨论
- 我的mysql已经可以连了,可是mysql_front 只能对数据库进行删除操作!
- 关于从数据读数据在页面上显示的格式问题
- 请问如何将一个数组里的所有元素初始化,以消除error_reporting函数的除错?
- 设置session会话失败?
- 关于Linux下的lamp安装顺序
- php怎么传递不在form的变量?
$page如果直接用需要先处理然后需要打开php.ini的
register_globals = On
register_globals不建议设成on
会有很多隐患
也包括php版本问题
你似乎获取page的语句都没有
里面的页面判断也不完善