php+mysqlページングクラス
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
リリース: 2016-07-25 08:43:39
カプセル化されたクラス: ";
}
}
?>
复制代
PHP ページに記述されたコード:
-
-
- include_once("fenye_php.php") // クラスを紹介します
-
- ///// //////////////////////////////////////////////// /// ////////////////
- $con = mysql_connect("localhost","root","");
- if (!$con)
- {
- die('接続できませんでした: ' . mysql_error());
- }
- mysql_select_db("myblog", $con) // 各ページに表示される番号を設定します
-
- /// //// //////////////////////////////////////////// /////// /////////////
-
- $pageSupport = new PageSupport($PAGE_SIZE) //PageSupport オブジェクトをインスタンス化します
-
- $current_page=$_GET["current_page" ];// 現在のページをページングします Count
-
- if (isset($current_page)) {
-
- $pageSupport->__set("current_page",$current_page)
-
- } else {
-
- $pageSupport->__set ("current_page",1);
-
- }
-
-
- $pageSupport->__set("sql","select * from Article ");
- $pageSupport->read_data();//データを読み取る
-
- if ($pageSupport->current_records > ; 0) //データが空でない場合は、データをアセンブルします
- {
- for ($i=0; $icurrent_records; $i++)
- {
- $ title = $pageSupport->結果[$i]["タイトル"];
- $content = $pageSupport->["コンテンツ"];
-
- $part=substr($content,0,400) ;
- // 各データを出力するループ
- echo '
'.$title.' class="index_content">'.$part .'
-
'
}
} // ページング HTML を表示するには、クラス内でこの関数を呼び出します。
//データベースを閉じる
mysql_close($con )
;
出典: http://blog.csdn.net/phpfenghuo/article/details/23207099
ページネーション、php、mysql
|
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、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