-------------------------------论坛--------------------------
数据表
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--------------------------
$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 "
$i } else {
echo " $i";
}
}
echo "]页----------------------------
"; printf("
追加主题
");
echo "
";
echo "
";
echo "";echo "主题 | ";
echo "电子邮件 | ";
echo "呢称 | ";
echo "回复 | ";
echo "最終回复時間间 | ";
echo "
";
for ($i=$start; $i<$end; $i ) {
$id=$guestbook[$i][0];
echo "";echo ""; echo "";echo $guestbook[$i][1]; echo ""; echo " | ";
echo ""; echo ""; echo $guestbook[$i][2];echo "";echo " | ";
echo ""; echo $guestbook[$i][3]; echo " | ";
echo ""; echo $guestbook[$i][4]; echo " | ";
echo ""; echo $guestbook[$i][5]; echo " | ";
エコー "
";
}
echo "
";
エコー "
";
printf("
追加主题");
?>
----------------------------444.php-------------- ------------------