php+mysql ページング クラス コード
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
リリース: 2016-07-25 08:52:47
复制發 ページングクラスの使用法:
-
-
- include_once("fenye_php.php") //クラスを紹介します
- ///////// //////////////////////////////////////////////// /// ////////////
- $con = mysql_connect("localhost","root","");
- if (!$con)
- {
- die('接続できませんでした: ' . mysql_error ());
- }
mysql_select_db("myblog", $con);//データベースを選択します
-
- $PAGE_SIZE=10;//各ページに表示される番号を設定します
- //// /////////////////////////////////////////// //////// //////////////////
- $pageSupport = new PageSupport($PAGE_SIZE) //PageSupport オブジェクトをインスタンス化します
- $current_page=$_GET[" current_page"];//現在のページのページ数
- if (isset($current_page)) {
- $pageSupport->__set("current_page",$current_page);
- } else {
- $pageSupport->__set(" current_page",1);
- }
-
- $pageSupport->__set("sql","記事から * を選択 ");
- $pageSupport->read_data();//データを読み取る
-
- if ($pageSupport- >current_records > 0) // データが空でない場合は、データをアセンブルします
- {
- for ($i<$pageSupport->current_records; $i++)
- {
- $title = $pageSupport ->結果[$i]["タイトル"];
- $content = $pageSupport->結果[$i]["コンテンツ"];
-
- $part=substr($content,0,400);各データをループして出力します
- echo '
'.$title.' ">'.$part.' div>
- '
- }
- }
- $pageSupport->standard_navigate(); //ページング HTML を表示します。データベース
- mysql_close($con);
-
-
-
- ;
-
-
-
-
|
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
著者別の最新記事
-
2025-02-26 03:58:14
-
2025-02-26 03:38:10
-
2025-02-26 03:17:10
-
2025-02-26 02:49:09
-
2025-02-26 01:08:13
-
2025-02-26 00:46:10
-
2025-02-25 23:42:08
-
2025-02-25 22:50:13
-
2025-02-25 21:54:11
-
2025-02-25 20:45:11
最新の問題
-
2025-03-21 13:39:34
-
2025-03-21 13:38:34
-
2025-03-21 13:37:19
-
2025-03-21 13:35:24
-
2025-03-21 13:34:32