xxx.php<?php
include ('xxxxx/dxxx.php');
$limit_2=8;
if (!$_GET[page]||$GET[page]==1)
{
$limit_1=0;
}
else
{
$limit_1=(($page-1)*8+1);
}
$query_article=mysql_query("select id,title,time from $article order by id desc limit $limit_1,$limit_2");
while ($row=mysql_fetch_array($query_article))
{
echo "<p>";
$times=$row["time"];
echo $times[0],$times[1],$times[2],$times[3],"-",$times[4],$times[5],"-",$times[6],$times[7];
echo "<a href='read.php?id=$row[id]' target='_blank'>";
echo $row['title'];
echo "</a></p>";
}
$query_article_total=mysql_query("select id from $article");
$rows_num=mysql_num_rows($query_article_total);
$pages_num=ceil($rows_num/8);
for ($i=1;$i<=$pages_num;$i++)
{
echo "<a href='article.php?page=$i'>$i</a> ";
}
?>我以前写的显示数据库最新内容的一个例子~看看吧
include ('xxxxx/dxxx.php');
$limit_2=8;
if (!$_GET[page]||$GET[page]==1)
{
$limit_1=0;
}
else
{
$limit_1=(($page-1)*8+1);
}
$query_article=mysql_query("select id,title,time from $article order by id desc limit $limit_1,$limit_2");
while ($row=mysql_fetch_array($query_article))
{
echo "<p>";
$times=$row["time"];
echo $times[0],$times[1],$times[2],$times[3],"-",$times[4],$times[5],"-",$times[6],$times[7];
echo "<a href='read.php?id=$row[id]' target='_blank'>";
echo $row['title'];
echo "</a></p>";
}
$query_article_total=mysql_query("select id from $article");
$rows_num=mysql_num_rows($query_article_total);
$pages_num=ceil($rows_num/8);
for ($i=1;$i<=$pages_num;$i++)
{
echo "<a href='article.php?page=$i'>$i</a> ";
}
?>我以前写的显示数据库最新内容的一个例子~看看吧
解决方案 »
- (CURL模拟表单搜索)求高人指点,如何获取表单发送地址???
- 求一小段php代码——将客户端IP、浏览器、操作系统、当前时间记录到数据库中
- 关于PHP,JSP
- 同一段php代码,显示不同结果,为什么?
- php服务器端+android客户端通讯问题,问题有点怪
- 我在该站传递参数后面加了单引号结果显示的仍然是对应页面,这种效果是怎么实现的?
- IIS+PHP5.0.4安装出现无法载入mysql扩展问题了!!!
- 我读取数据的时候为什么成这样?
- 如何用php保存整个用户登录过程的信息?最后23分了。
- [伸手党]求个function,传入一个规律的二维数组,每个子数组都是键名相同的数组,键值都是整数,返回结果是二维数组多了一个子数组,是每个子数组的求和结果
- 包含<script>网页语法错
- 在form表单中的mime类型是干什么用的?
index.htm<html>
<head>
<title>test</title>
</head>
<body>
<script src="script.php"></script>
</body>
</html>script.php<?php
echo time();
?>可是网页上什么都不显示,真郁闷....
注意删除 HTML 码中的所有引号,然后这样写echo "document.write(\"$JsOutput\")";
另外也非常谢谢surfchen