首页 Soft PlugIn RAN乱 Dev开发 Info资料 English WAP 留言 登陆 注册
-
Posted by Yippee | 评论(2) | 引用(0) | 阅读1799次
iwas15-clsdb dbex

<?php
class clsdb
{
 var $link=false;
 function Connn($host,$user,$pwd,$db)
 {
     $this->link = mysql_connect($host,$user,$pwd)
        or die("Could not connect : " . mysql_error());
     mysql_select_db($db) or die("Could not select database");
     $sql="set names 'gb2312'";
     mysql_query($sql);
  }
 function Conn()
 {
     $this->link = mysql_connect("localhost","root","123")
        or die("Could not connect : " . mysql_error());
     mysql_select_db("iwas") or die("Could not select database");
  }
 function Exec($sql)
 {
  if ($this->link==false)
  {
   $this->Conn();
   }
  $result=mysql_query($sql) or die("Query failed : " . mysql_error());
  return $result;
  }
 function ExecCls($result)
 {
  mysql_free_result($result); 
  }
 function Close()
 {
  if($this->link!==false)
   mysql_close($this->link);
  }
}

class clsdbex extends clsdb
{
 function GetParam($namee)
 {
  $result=clsdb::Exec("select * from param where namee='".$namee."'");
        $row = mysql_fetch_array($result);
        $vall=$row['vall'];
        clsdb::ExecCls($result);
        return $vall; www.shengfang.org
  }
 function SetParam($namee,$vall)
 {
  clsdb::Exec("update param set vall='".$vall."' where namee='".$namee."'");
  }
 function GetParamAry($namee) www.shengfang.org
 {
       $resource = clsdb::Exec("select * from param where namee='".$namee."'");
       if(mysql_num_rows($resource) > 0)
       {
           $result = array();             www.shengfang.org
           while ($row = mysql_fetch_array($resource))
           {
               $result[] = $row["vall"];
           }//end while
           return $result;
       }//end if
       return false; www.shengfang.org
   }//end function
 function GetCataAry($parent)
 {
       $resource = clsdb::Exec("select * from cata where parent".$parent);
       if(mysql_num_rows($resource) > 0)
       {
           $result = array();           
           while ($row = mysql_fetch_array($resource))
           {
               $result[] = $row["namee"];
           }//end while
           return $result;
       }//end if
       return false; www.shengfang.org
   }//end function
   function AddCata($namee,$parent)
 {
       $resource = clsdb::Exec("insert into cata (namee,parent) values('".$namee."',".$parent.")");
       $resource=clsdb::Exec("select id from cata where parent=".$parent." and namee='".$namee."'");
       $row = mysql_fetch_array($resource);
       return $row["id"];
   }//end function www.shengfang.org
   function UpdateCata($nnamee,$onamee)
 {
       $resource = clsdb::Exec("update cata set namee='".$nnamee."' where  namee='".$onamee."'");
      
   }//end function
   function delCata($namee,$parent)
 {
       $resource = clsdb::Exec("delete from cata  where namee='".$namee."'");
   }//end function www.shengfang.org
   function GetCataID($namee,$parent)
 {
       //$resource=clsdb::Exec("select id from cata where parent=".$parent." and namee='".$namee."'");
       $resource=clsdb::Exec("select id from cata where   namee='".$namee."'");
       $row = mysql_fetch_array($resource);
       $idd=$row["id"]; www.shengfang.org
       return $idd;
  }
 function GetCataName($idd)
 {
       //$resource=clsdb::Exec("select id from cata where parent=".$parent." and namee='".$namee."'");
       $resource=clsdb::Exec("select namee from cata where   id=".$idd);
       $row = mysql_fetch_array($resource);
       $namee=$row["namee"];
       return $namee;
  }
 function GetCataParentID($namee,$parent)
 {
       //$resource=clsdb::Exec("select id from cata where parent=".$parent." and namee='".$namee."'");
       $resource=clsdb::Exec("select parent from cata where   namee='".$namee."'");
       $row = mysql_fetch_array($resource);
       $idd=$row["parent"];
       return $idd;
  } www.shengfang.org


字体:

Permanant URI永久地址 http://www.shengfang.org/blog/p/iwasclsdbex.php
Trackback URI引用地址 http://www.shengfang.org/blog/tb.php?tb_id=1125196625

2005年8月28日10:37星期日  [Dev开发] 追踪此文的RSS
该评论由手机发表Tonos在 2005年12月7日22:32星期三 评论:
Tonos

该评论由手机发表Tonos在 2005年12月7日22:29星期三 评论:
Tonos

称呼:    登陆   注册
   不注册,但记住我的信息
邮件:
(非必须)
评论: [UBB代码帮助]
粗体 斜体 下划线 链接 水平线 引用



验证码: 请输入你看见的数字
关闭UBB      提交时自动将内容复制到剪贴板

公告





统计信息
[Yippee]||[统计]||日志:2143
在线: 13||用户: 2635 [列表]
今日:777||到访:3654562
Rss:||评论:1668

最新日志

最新评论

友情链接

日历
342009 - 0734
   1234
567891011
12131415161718
19202122232425
262728293031 

最新引用
搜索

归档

杂项
Get RSS Feed (Version 2.0)
Get Atom Feed (Version 0.3)
编码:  UTF-8