首頁 後端開發 php教程 无限分类&树型论坛的实现_PHP教程

无限分类&树型论坛的实现_PHP教程

Jul 13, 2016 pm 05:12 PM
amp 程式碼 分類 實現 數據表 無限 論壇

数据表参考:
代码:--------------------------------------------------------------------------------
CREATE TABLE `mf_sort` (
`sortid` SMALLINT( 3 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
`main` TINYINT( 2 ) UNSIGNED NOT NULL ,
`parentid` SMALLINT( 3 ) UNSIGNED NOT NULL ,
`layer` SMALLINT( 3 ) UNSIGNED NOT NULL ,
`orders` TINYINT( 2 ) UNSIGNED NOT NULL ,
`sort` VARCHAR( 100 ) NOT NULL ,
PRIMARY KEY ( `sortid` ) ,
INDEX ( `main` , `parentid` , `layer` , `orders` )
);
--------------------------------------------------------------------------------
关键的函数
PHP代码:--------------------------------------------------------------------------------
function get_main_layer_orders($parentid)
{
global $x_db;
$sql = "select `main`, `layer`, `orders` ";
$sql .= "from `mf_sort` ";
$sql .= "where `postid`='$parentid'";
$x_db->exec($sql);
$data = $x_db->get_data();
$layer = $data[0]['layer']+1;
$main = $data[0]['main'];
$orders = $data[0]['orders'];
$sql = "select `sortid` from `mf_sort` ";
$sql .= "where `parentid`='$parentid'";
$x_db->exec($sql);
$n = $x_db->n;
if ($n>0)
{
$lastid = $parentid;
get_lastid($lastid);
$sql = "select `orders` from `mf_sort` ";
$sql .= "where `sortid`='$lastid'";
$x_db->exec($sql);
$data = $x_db->get_data();
$orders = $data[0][0];
$sql = "update `mf_sort` ";
$sql .= "set `orders`=`orders`+1 ";
$sql .= "where `orders`>$orders and `main`='$main'";
$x_db->exec($sql);
$orders = $orders + 1;
return array($main, $layer, $orders);
}

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/629306.htmlTechArticle数据表参考: 代码:-------------------------------------------------------------------------------- CREATE TABLE `mf_sort` ( `sortid` SMALLINT( 3 ) UNSIGNED NOT NULL AUTO_INCRE...
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

AI Hentai Generator

AI Hentai Generator

免費產生 AI 無盡。

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
2 週前 By 尊渡假赌尊渡假赌尊渡假赌
倉庫:如何復興隊友
4 週前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒險:如何獲得巨型種子
3 週前 By 尊渡假赌尊渡假赌尊渡假赌

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

華為手機如何實現雙微信登入? 華為手機如何實現雙微信登入? Mar 24, 2024 am 11:27 AM

華為手機如何實現雙微信登入?

GE通用遠端程式碼可在任何裝置上編程 GE通用遠端程式碼可在任何裝置上編程 Mar 02, 2024 pm 01:58 PM

GE通用遠端程式碼可在任何裝置上編程

如何在華為手機上實現微信分身功能 如何在華為手機上實現微信分身功能 Mar 24, 2024 pm 06:03 PM

如何在華為手機上實現微信分身功能

PHP程式設計指南:實作斐波那契數列的方法 PHP程式設計指南:實作斐波那契數列的方法 Mar 20, 2024 pm 04:54 PM

PHP程式設計指南:實作斐波那契數列的方法

掌握Golang如何實現遊戲開發的可能性 掌握Golang如何實現遊戲開發的可能性 Mar 16, 2024 pm 12:57 PM

掌握Golang如何實現遊戲開發的可能性

Discuz論壇權限管理:閱讀權限設定指南 Discuz論壇權限管理:閱讀權限設定指南 Mar 10, 2024 pm 05:33 PM

Discuz論壇權限管理:閱讀權限設定指南

PHP遊戲需求實作指南 PHP遊戲需求實作指南 Mar 11, 2024 am 08:45 AM

PHP遊戲需求實作指南

清華大學與智譜AI重磅開源 GLM-4:掀起自然語言處理新革命 清華大學與智譜AI重磅開源 GLM-4:掀起自然語言處理新革命 Jun 12, 2024 pm 08:38 PM

清華大學與智譜AI重磅開源 GLM-4:掀起自然語言處理新革命

See all articles