PHP 的 MySQL 操作类,跟手册上的函数一样用,但是更方便了。多说无益,看了就知道了。(8) function getRows(){ /* 取得已经读出的数据记录数 */ return $this->Rows; }
function getDBName(){ return $this->DBName; }
function nextRecord($resultType = 0){ /* 跟 phplib 接轨,同 phplib 的 next_record */ $record = NULL; switch($resultType){ case 1: $record = @mysql_fetch_assoc($this->Result); $this->RecordCase = 1; break; case 2: $record = @mysql_fetch_row($this->Result); $this->RecordCase = 2; break; case 3: $record = @mysql_fetch_object($this->Result); $this->RecordCase = 3; break; default: $record = @mysql_fetch_array($this->Result); $this->RecordCase = 0; break; } if(is_resource($record)){ $this->Record = $record; }else{ return false; } }
function f($fieldName){ /* 跟 phplib 接轨 */ switch($this->RecordCase){ case 3: return is_object($this->Record)?$this->Record->$fieldName:NULL; break; default: return $this->Record[$fieldName]; break; } }/* 下面的自己可以定义格式 */ function halt($msg = "未知错误!", $MustBeHalt = 0){ echo $msg; if($MustBeHalt !== 0 $this->getMustBeHalt()){ die(); } }/* 下面的可要可不要,因为得PHP5才行 */ function __get($nm){ if(isset($this->$nm)){ //