我的一亩三分地 我就喜欢!
13fen  设为主页
 收藏本站
 
当前位置: > 一亩三分地:首页 > 网络学院 > 网络编程 > PHP专区 > php安装/入门 > 国外好东西真的多,现在贴上一个访问ACCESS的类!
热门文章排行
热门文章排行 检查email地址格式的代码(01-11)
PHP操作文件问答(01-11)
PHP安装攻略:安装并配置PHP(10-23)
PHP的十个高级技巧 4(10-23)
PHP控制语句(10-12)
精采文章排行
精采文章排行 PHP连接MYSQL的两种方法(11-15)
PHP和MySQL开发的8个技巧(10-23)
PHP安装攻略:安装并配置PHP(10-23)
php+mysql扎实个人基本功(10-23)
PHP编程常用技巧四则(10-23)
技术专题推荐
网管论坛交流
 

国外好东西真的多,现在贴上一个访问ACCESS的类! 

作者:佚名   来源:本站教程   点击:   日期:2007-01-11

这是ACCESS的类

<?
Class AccessDBM
{
    var $COUNT = 0;
    var $VALUES = array();
    var $FILE = "";
    var $ERROR = "";
    var $EXISTS = false;
    var $STATIC = false;
    var $EXACT = false;
    var $DBM;

//    Older version of PHP can't do the 'new ClassName(args)'
//    Use initilize() if this is the case.

//    *******************************************************

    function AccessDBM ($dbmFile, $static = 0)
    {
        global $php_errormsg;

        if(!empty($dbmFile))
        {
            if(file_exists($dbmFile))
            {
                $this->EXISTS = true;
            }
            if($static != 0)
            {
                $this->STATIC = true;
            }
            $this->FILE = $dbmFile;
        }
        return;
    }

//    *******************************************************

//    Identical to AccessDBM
    function initialize ($dbmFile, $static = 0)
    {
        global $php_errormsg;

        if(!empty($dbmFile))
        {
            if(file_exists($dbmFile))
            {
                $this->EXISTS = true;
            }
            if($static != 0)
            {
                $this->STATIC = true;
            }
            $this->FILE = $dbmFile;
        }
        return;
    }

//    *******************************************************

    function add_entry ($key, $val)
    {
        $results = 0;
        $dbm = $this->open_dbm();
        if(!$dbm) { return false; }

        if(!(dbmreplace($dbm,$key,$val)))
        {
            if(!(dbmexists($dbm,$key)))
            {
                $this->ERROR = "Fatal error : could not replace $key with $val";
                $this->close_dbm($dbm);
                return false;
            }
        }
        $this->close_dbm($dbm);
        return true;        
    }

//    *******************************************************

    function remove_entry ($Key)
    {
        global $php_errormsg;
        $removed = false;

        $dbm = $this->open_dbm();
        if(!$dbm) { return false; }

        if(dbmexists($dbm,$Key))
        {
            if(!dbmdelete($dbm,$Key))
            {
                if(dbmexists($dbm,$Key))
                {
                    $this->ERROR = "Unable to remove [$Key] : [$php_errormsg]";
                    $this->close_dbm($dbm);
                    return false;
                }
            }
            else
            {
                $this->close_dbm($dbm);
                $removed = true;
            }
        }
        else
        {
            $this->ERROR = "Key [$Key] does not exist";
            $this->close_dbm($dbm);
            return false;
        }
        return true;
    }

//    *******************************************************

    function get_value ($Key)
    {
&nbs

文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【论坛讨论

   相关文章:
·将OICQ数据转成MYSQL数据 ·用PHP实现ODBC数据分页显示一例
·php生成WAP页面 ·PHP与Javascript的两种交互方式
·PHP+Javascript模拟Matrix画面 ·WHOIS类的修改版

   文章评论:(条)
  
 请留名: 匿名评论   点击查看所有评论 网管论坛
 

  责任编辑:一分  声明:刊登此文章是为了传递更多信息,文章内容仅供参考,转载请注明出处。