首頁 >後端開發 >php教程 >一個分頁的論壇_PHP教程

一個分頁的論壇_PHP教程

WBOY
WBOY原創
2016-07-21 16:01:27675瀏覽

-------------------------------论坛--------------------------
数据表
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  if ($i!=$page) {
   echo " $i";
  } else {
   echo " $i";
  }
}
echo "]頁----------------------------------- - -----
";   printf("新增主題

");
回顯「
」;
   echo "";
    echo "";echo "主題 ”;
                  echo " 電子郵件";
        =aaaaaa border=1 style=border: 1px Solid rgb(3,2,1)>呢稱為";
                1px 實心rgb(3,2,1)>回覆";
                echo "最後回覆時間";
                 echo "
";
   for ($i [$i][0];

  echo "";echo "";
  echo "";echo $guestbook[$i][1];迴聲「」;迴聲「」;
   echo "";
  echo "";  迴聲$guestbook[$i][2];迴聲“”;迴聲“”;

   echo "";
  echo $guestbook[$i][3];迴音「」;
   echo "";
  echo $guestbook[$i][4];迴音「」;
   echo "";
  echo $guestbook[$i][5];迴音「」;
   回顯「
」;


}
     echo "";

  回顯「
」;

printf("新增主題")🎜> printf("新增主題")🎜> printf("新增主題")🎜> printf("新增主題") ;


? >
------------------------------444.php------------- - ------------------
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn