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

    function SetValue($Index,$Value) //指定数据,跟在AddNew后执行;
    {
             if($this->NewEdit==0)
             {
                $this->nErr=1;
                $this->sErr="SetValue:请先执行AddNew()或者Edit()!";
                return;
             }
             if(is_int($Index))
             {
                 if($Index<0||$Index>$this->nCols)
                 {
                    $this->nErr=1;
                    $this->sErr="SetValue:插入不存在的列值!";
                    return;
                 }
                 $this->aNew[$Index]=$Value;
                 $tmpIn=$Index;
             }
             elseif(is_string($Index))
             {
                $Index=strtolower($Index);
                for($i=0;$i<$this->nCols;$i++)
                {
                    if($this->aFName[$i]==$Index)
                       break;
                }
                if($i==$this->nCols)
                {
                    $this->nErr=1;
                    $this->sErr="SetValue:插入不存在的列值!";
                    return;
                 }
                 $this->aNew[$i]=$Value;
                 $tmpIn=$i;
             }
                 if(!empty($this->sName))
                    $this->sName.=",";
                 $this->sName.=$this->aFName[$tmpIn];
                 //根据当前字段的类型生成相应的新值
                 if($this->sValue!="#@!")
                    $this->sValue.=",";
                 else
                    $this->sValue="";
                 $ftype=@sql/Index.html'>mysql_field_type($this->nResult,$i);
                 //echo($ftype.",".$this->aNew[$i].",".$i.":".$sValue."
");
                
                 switch($ftype)
                 {
                  case "string":
                  case "date":
                  case "datetime":
                        $this->sValue.="\"".$this->aNew[$tmpIn]."\"";
                        $this->sEdit="\"".$this->aNew[$tmpIn]."\"";
                        break;
                  case "int":
                  case "unknown":
                       $this->sValue.=$this->aNew[$tmpIn];
                       $this->sEdit=$this->aNew[$tmpIn];
                       break;
                  default:
                       $this->nErr=1;
                       $this->sErr="Update:字段名为".$this->aFName[$tmpIn]."的".$ftype."类型目前版本不支持,请用别的方法添加数据!";
                       return;
                 }

上一页  [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条。评论内容只代表网友观点,与本站立场无关!)
    | 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | 管理登录 |