| 网站首页 | JAVA文章 | AppServers | Web开发 | 应用开发 | 资源下载 |
    想学好编程,外语很重要,最新的编程技术还是在国外  [enadd  2006年12月25日]        
设为首页 加入收藏 联系站长
您现在的位置: 编程笔记网 >> 数据库 >> mysql >> 使用实例 >> 文章正文
Mysql数据库的操作类(已封装)            【字体:
Mysql数据库的操作类(已封装)
作者:不详    文章来源:网络    点击数:    更新时间:2007-1-21

    function Initialize()
    {
      $this->nErr=0;
      $this->NewEdit=0;
      $this->nResult=-1;
      $this->nCols=0;
      $this->nRows=0;
      $this->nOffset=0;
      $this->EOF=true;
      $this->sName="";
      $this->sValue="#@!";
      $this->sEdit="#@!";
      unset($this->aFName);
      unset($this->aNew);
    }
    function MySQLDB($TableName="",$database="slt")  //构造函数
    {
      $this->Initialize();
      $this->sTName=$TableName;
      $this->linkid=MySQL_connect($host,$user,$password);
      if(!$this->linkid)
      {
        $this->nErr=1;
        $this->sErr="MySqlDB:数据库连接出错,请启动服务!";
        return;
      }
      $this->dbid=sql/Index.html'>mysql_select_db($database);
      if(!$this->dbid)
      {
        $this->nErr=1;
        $this->sErr="MySqlDB:选择的数据库".$database."不存在!";
        return;
      }
    }

    function IsEmpty($Value)
    {
            if(is_string($Value)&&empty($Value))
               return true;
            return false;
    }

    function Destroy()          //数据清除处理
    {
      sql/Index.html'>mysql_query("commit");
      sql/Index.html'>mysql_close();
    }

    function PrintErr()
    {
      if($this->nErr==1)
      {
        echo($this->sErr."

");
      }
      else
      {
        echo("没有错误

");
      }
    }

        function Execute($SQL)  //直接执行SQL语句
          {
                if(empty($SQL))
                  {
                        $this->nErr=1;
                        $this->sErr="Execute:执行语句不能为空!";
                        return false;
                  }
                 $this->sSQL=$SQL;
                  if(!sql/Index.html'>mysql_query($SQL))
                  {
                          $this->nErr=1;
                          $this->sErr="Execute:SQL语句:".$SQL."
MySql错误:".sql/Index.html'>mysql_error();
                          return false;
                  }
                  return true;
          }

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] 下一页  

文章录入:enadd    责任编辑:enadd 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
  • MySQL数据的导出和导入工具:…

  • mysql授课大纲

  • mysql技巧总结

  • PPTP + MPPE + RADIUS + MyS…

  • 使用函数递归实现基于php和M…

  • 基于MySQL的高性能数据库应用…

  • Mysql日期和时间函数

  • 深圳讯天 mysql 服务器错误分…

  • 几分钟让你走进mysql的门

  • 针对 Apache 2.x 的 MySQL 用…

  •   网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    | 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | 管理登录 |