一个分页的论坛
一个分页的论坛,一个分页的论坛
数据表
create table guest(id int not null auto_increment,primary key(id),title varchar(50),email varchar(30),homepage varchar(30),name varchar(30),text text,relay int,r_time date)
create table relay(id int not null auto_increment,primary key(id),title int,email varchar(30),name varchar(30),text text)
-------------------------index.php--------------------------
<STYLETD{FONT-FAMILY:"宋体";FONT-SIZE:13pt}BODY{FONT-FAMILY:"宋体";FONT-SIZE:13pt}SELECT{FONT-FAMILY:"宋体";FONT-SIZE:13pt}A{COLOR:blue;FONT-FAMILY:"宋体";FONT-SIZE:13pt;TEXT-DECORATION:none}</STYLE
<div <p align=center<font size=14<b网站完全手册</font</p </div
<?php
$db =mysql_connect("localhost", "****","****");
mysql_select_db("****",$db);
@$result = mysql_query("SELECT * FROM guest order by id desc",$db);
$i=0;
while($myrow = mysql_fetch_row($result)) {
$guestbook[$i][0] = $myrow[0];
$guestbook[$i][1] = $myrow[1];
$guestbook[$i][2] = $myrow[2];
$guestbook[$i][3] = $myrow[4];
$guestbook[$i][4]=$myrow[6];
$guestbook[$i][5]=$myrow[7];
$i++;
} //读入数组
mysql_close($db) ;
echo "-----------------------------共[";
if ($q!="") {
$page = $q;
} else {
$page = 0;
}
$i=count($guestbook);
$msgnum=20; // 每页20笔
$start = $page * $msgnum;
$end = $start + $msgnum;
if ($end $i) $end=$i;
$totalpage=$i/$msgnum;
for ($i=0; $i<$totalpage; $i++) {
if ($i!=$page) {
echo "<a href=index.php?q=$i $i</a";
} else {
echo " $i";
}
}
echo "]页-----------------------------<br"; printf("<p align=right<a href=111.php添加主题</a</p");
echo "<br";
echo "<table width=700 hight=560 align=center border=1 ";
echo "<tr";echo "<td align=center width=200 bgcolor=aaaaaa border=1 style=border: 1px solid rgb(3,2,1)主题</td";
echo "<td align=center width=200 bgcolor=aaaaaa border=1 style=border: 1px solid rgb(3,2,1)电子邮件</td";
echo "<td align=center width=80 bgcolor=aaaaaa border=1 style=border: 1px solid rgb(3,2,1)呢称</td";
echo "<td align=center width=60 bgcolor=aaaaaa border=1 style=border: 1px solid rgb(3,2,1)回复</td";
echo "<td align=center width=200 bgcolor=aaaaaa border=1 style=border: 1px solid rgb(3,2,1)最后回复时间</td";
echo "</tr";
&