日期:2013-07-07  浏览次数:20576 次

==================================================
file name:
dboper.inc.php
codes:
==================================================
<?
class dboper {
    var $items;
    var $result=0;
    
    function find($l_value) {
        for($j=1;$j<=$this->items["info_all"];$j++) {
            if($l_value==$this->items["d_id][$j]"])
            { return($j);exit; }
        
        }
            
    }
    
    function del($id) {
        //echo "del"." ".$id."<br>";
        include("conn_db.php");
        $Sql_Query="delete from department where d_id=$id";
        $Query_Db=mysql_query($Sql_Query,$Connect);
        
        //echo $Sql_Query;
        include("conn_close.php");
    }
    
    function update($d_id,$f_node,$l_node,$r_node) {
        include("conn_db.php");
        $Sql_Query="update department set f_node=".$f_node.",l_node=".$l_node.",r_node=".$r_node." where d_id=".$d_id;
        $Query_Db=mysql_query($Sql_Query,$Connect);
        
        //echo $Sql_Query;
        include("conn_close.php");
    }
        
    function d_tree($id,$base_id){//
        //echo "do<br>";
        $m=$this->find($base_id);//m is the position of $base_id in arrays
        $i=$this->find($id);
        
        if(($this->items["l_node][$i]"]!=0))
        {    
            //echo "向左下一级";
            //echo "<br>";
            $i=$this->find($this->items["l_node][$i]"]);
            $this->d_tree($this->items["d_id][$i]"],$base_id);
            //exit;
        }
        if(($this->items["r_node][$i]"]!=0)&&($this->items["l_node][$i]"]==0))
        {    
            //echo "向右下一级";
    &nb