http://feyge.home.chinaccd.net/bbs/list.php
解决方案 »
- 为什么将操作数据库的函数封装后就连接不上数据库?
- windowsXP + EasyPHP局域网内不能访问我的页面,但我自己localhost可以访问,是什么问题?
- 提交订单 扣除费用 同时进行
- 高手帮忙看下,return的问题.
- 请问大家php或者script下有没有能让pc喇叭发声的脚本?
- 请教一个关于FCKeditor2.0 的一个问题
- 学习PHP5的面向对象的编程方法,原来的这段面向过程的代码该如何修改?
- 请教各位高手,从昨天起我的PHP经常出现"PHP has encountered an Access Violation at XXXXXXXX"
- 同名不同路径COOKIE
- 自己做了一个简单的查询,用的php,但是有时候向前台返回数据,有时候不反回,我之前做了一记事本没有这种情况,我想问一下是php代码的问题还是js代码的问题,谢谢
- Undefined variable的问题--新手
- 3000分啊,小CASE来看看,捧捧场也好
你的这个页面正是我想实现的,挺不错的,可以把源码和数据表发给我吗?我的email是[email protected] 在此,先谢谢你,如果你嫌分不够,那么以后,我再给你加。好吗?
[id] [int] IDENTITY(1, 1) NOT NULL,
-- 层次
[parent_id] [int] NOT NULL DEFAULT(0),
[root_id] [int] NOT NULL DEFAULT(0),
[depth] [int] NOT NULL DEFAULT(1),
[sort_key] [varchar] (200) NOT NULL DEFAULT(' '), [name] [varchar] (80) NOT NULL,
PRIMARY KEY ([id]),
UNIQUE ([sort_key]) -- 排序关键字不能重复
)
这是我的数据库结构,可以根据你的需求,将
[parent_id] [int] NOT NULL DEFAULT(0),
[root_id] [int] NOT NULL DEFAULT(0),
[depth] [int] NOT NULL DEFAULT(1),
[sort_key] [varchar] (200) NOT NULL DEFAULT(' '),
这四个字段做适当的删除,但
[sort_key] [varchar] (200) NOT NULL DEFAULT(' '),
不能删除。=================一代过去,一代又来,地却永远长存。日头出来,日头落下,急归所出之地。
风往南刮,又往北转,不住的旋落,而且返回转行原道,江河都往海里转,海
却不满,江河从何处流,仍归何处。
' @param varID :
' @param varParentID :
' @return
Private Sub SetSortKey(ByVal varID, ByVal varParentID)
Dim lngRootID, strDepth, strSortKey
Dim strSql
Dim objString Set objString = New GString ' Read Parent Row data
If varParentID > 0 Then
strSql = "SELECT * FROM ts_department WHERE id=" & varParentID
OpenRecordset strSql
If Not adoRst.BOF And Not adoRst.EOF Then
lngRootID = adoRst("root_id")
strDepth = adoRst("depth") + 1
strSortKey = adoRst("sort_key")
End If
Else
lngRootID = -1
strDepth = 1
strSortKey = ""
End If ' Set Current Row data
strSql = "SELECT * FROM ts_department WHERE id=" & varID
OpenRecordset strSql
If Not adoRst.BOF And Not adoRst.EOF Then
If lngRootID = -1 Then
adoRst("root_id") = adoRst("id")
Else
adoRst("root_id") = lngRootID
End If
adoRst("depth") = strDepth
adoRst("sort_key") = strSortKey & objString.Dec2Hex(adoRst("id"), 6) adoRst.Update
End If
End Sub这是我写的生成sort_keyr函数,你可以试试。
里面我用到了自己写的类。
代码是ASP的,改到PHP很容易。=================一代过去,一代又来,地却永远长存。日头出来,日头落下,急归所出之地。
风往南刮,又往北转,不住的旋落,而且返回转行原道,江河都往海里转,海
却不满,江河从何处流,仍归何处。