¸øÄãÃÇÒ»¸öºÃ¶«¶«
Á¬½ÓºÍ²Ù×÷SQL SERVERºÍDBASEµÄ¼¯ºÏÀ࣬¹¦ÄÜÈ«Ãæ£¬½ö¹©²Î¿¼~~~ BaseDB.php <?php /* * Session Management for PHP4.1 * * (C) Copyright 2001 Cameron Taggart (cameront@wolfenet.com) * * $Id: db_mssql.inc,v 1.3 2001/05/17 01:19:37 chrisj Exp $ * MS SQL Server database¾Þ§@°òÃþ,±Nmssql.dll©Ò´£¨Ñ¤§¨ç¼Æ¥[¥H¬ÛÀ³³B²z *¥¯à: connect,close database * ²¾°Ê°O¿ý«ü°w,Àò¨ú¬ÛÀ³¬Ûdatabase ¼Æ¾Ú * *³s±µdatabase¤è¦¡:mssql.dll°ÊºA®wª½±µ³s±µ */ # echo "<BR>This is using the MSSQL class<BR>";
//Error ³B²zÃþ //1:¥¼Connect;2:¤£¦s¦bResµ²ªG¶° class Error { var $Errno=0; var $Error='failed'; var $Msg='function failed'; var $ErrFile='BaseDB.php'; var $ErrClass='BaseDB'; }
//Database°òÃþ class BaseDB { var $Con=0; var $Res=false; var $RecordCount=-1; // ¼Æ¾Ú°O¿ýÁ`¼Æ var $RecordNum=-1; //«ü°w©Ò«ü¦Vªº·í«e°O¿ý¼Æ var $EOF=true; //§PÂ_«ü°w¬O§_«ü¦V°O¿ý³Ì¥¼ var $BOF=true; //§PÂ_«ü°w¬O§_«ü¦V°O¿ý³Ì«eºÝ var $Errno = ''; var $Error = ""; var $parent; var $Auto_Free = 0; ## set this to 1 to automatically free results var $Err=null; var $dbtype = "MSSQL";
/* public: constructor */ function getversion(){ return "1.1"; } function BaseDB($type="mssql"){ $this->dbtype = strtoupper($type); }
function Set_dbtype($type){ $this->dbtype=strtoupper($type); }
function Get_dbtype(){ return $this->dbtype; } //³s±µDatabase ,ServerName:database¤§host; DatabaseName:¼Æ¾Ú®w¦W; UserID:¥Î¤á¦W; Password:¥Î¤á±K½X function Connect($ServerName,$DatabaseName,$UserID,$Password) { switch ($this->dbtype){ case "MSSQL": if ( 0 == $this->Con ) { $this->Con=@mssql_connect($ServerName,$UserID,$Password); if (!$this->Con){ $this->SetErr('BaseDB.php','BaseDB','¥´¶}¼Æ¾Ú®w¥¢±Ñ',$php_errormsg); return false; } else if(!@mssql_select_db($DatabaseName, $this->Con)){ $this->SetErr('BaseDB.php','BaseDB','¼Æ¾Ú®w¦WDatabaseName¿ù»~',$php_errormsg); return false; }else return true; } break; case "MYSQL": if ( 0 == $this->Con ) { $this->Con=@mysql_connect($ServerName,$UserID,$Password); if (!$this->Con){ if(strlen($emsg = @mysql_error()) == 0 && isset($php_errormsg)) $emsg = $php_errormsg; $this->SetErr('BaseDB.php','BaseDB','¥´¶}¼Æ¾Ú®w¥¢±Ñ',$emsg); //echo "connect faled".$php_errormsg; return false; } else if(!@mysql_select_db($DatabaseName, $this->Con)){ $this->SetErr('BaseDB.php','BaseDB','¿ï¾ÜDatabase¥X¿ù',@mysql_error()); return false; }else return true; } break; case "PGSQL": case "POSTGRESQL": if ( 0 == $this->Con ) { $this->Con=@pg_pconnect("host=$ServerName user=$UserID password=$Password port=5432 dbname=$DatabaseName"); //$this->Con=@odbc_pconnect('noa','noa','noa'); if (!$this->Con){ if(isset($php_errormsg)) $emsg = $php_errormsg; if(strlen($msg = @pg_last_error()) > 0 ) $emsg = $msg; $this->SetErr('BaseDB.php','BaseDB','¥´¶}¼Æ¾Ú®w¥¢±Ñ',$emsg); return false; }else return true; } break; case "ODBC": if ( 0 == $this->Con ) { $this->Con=@odbc_connect($DatabaseName,$UserID,$Password); //$this->Con=@odbc_pconnect('noa','noa','noa'); if (!$this->Con){ if(isset($php_errormsg)) $emsg = $php_errormsg; if(strlen($msg = @odbc_error()) >0 ) $emsg = $emsg."(".$msg.")"; $this->SetErr('BaseDB.php','BaseDB','¥´¶}¼Æ¾Ú®w¥¢±Ñ',$emsg); return false; }else{ return true; } } break; default : $this->SetErr('BaseDB.php','BaseDB','Mysql,MSsql,pgsql,ODBC',"¼Æ¾Ú®wÃþ«¬¿é¤J¿ù»~,²{¤ä«ùDBÃþ«¬:MySQL,MSSQL,PgSQL/PostgreSQL,ODBC"); return false; } } function Close(){ //Ãö³¬³s±µ,ÄÀ©ñMemory switch ($this->dbtype){ case "MSSQL": if($this->Res){ @mssql_free_result($this->Res) ; $this->Res=0; } if($this->Con){ @mssql_close($this->Con); $this->Con=0; } break; case "MYSQL": if($this->Con){ @mysql_close($this->Con); $this->Con=0; } break; case "PGSQL": case "POSTGRESQL": if($this->Con){ @pg_close($this->Con); } break; case "ODBC": if($this->Con){ @odbc_close($this->Con); } break; } }
function BeginTrans($str=""){ switch ($this->dbtype){ case "MSSQL": if($this->exec("begin transaction")) return true; else return false; break; case "PGSQL": case "POSTGRESQL": if ($this->exec("begin")) return true; else return false; break; case "ODBC": @odbc_autocommit($this->Con, false); break; default: if(strlen($str) > 0){ if($this->exec($str)) return true; else return false; } return false; } }
function CommitTrans($str=""){ switch ($this->dbtype){ case "MSSQL": if($this->exec("commit transaction")) return true; else return false; break; case "PGSQL": case "POSTGRESQL": if ($this->exec("COMMIT")) return true; else return false; break; case "ODBC": return (@odbc_commit($this->Con)); default: if(strlen($str) > 0){ if($this->exec($str)) return true; else return false; } return false; } }
function Rollback($str=""){ switch ($this->dbtype){ case "MSSQL": if($this->exec("rollback transaction")) return true; else return false; break; case "PGSQL": case "POSTGRESQL": if ($this->exec("ROLLBACK")) return true; else return false; break; case "ODBC": return (@odbc_rollback($this->Con)); default: if(strlen($str) > 0){ if($this->exec($str)) return true; else return false; } return false; } }
//°õ¦æSQL»y¥y,±Nµ²ªG¶°½á¥ÙRes ;SQL»y¥y¬°§¹¾ã¤§SQL»y¥y function Open($strSQL){ if($this->Con==0){ $this->SetErr('BaseDB.php','BaseDB','°õ¦æSQL»y',$this->dbtype." Server ¥¼«Ø¥ß³s±µ"); return '-1'; } else{ if(strlen($strSQL)==0){ $this->SetErr('BaseDB.php','BaseDB','°õ¦æSQL»y¥y¥¢±Ñ','SQL»y¥y¤£¯à¬°ªÅ'); return '-1'; } else{ switch ($this->dbtype){ case "MSSQL": $this->Res=@mssql_query($strSQL,$this->Con); break; case "MYSQL": $this->Res=@mysql_query($strSQL,$this->Con); break; case "PGSQL": case "POSTGRRESQL": $this->Res=@pg_query($this->Con,$strSQL); break; case "ODBC": $this->Res=@odbc_do($this->Con,$strSQL); break; default: return -1; } //echo '0'.$this->Res; if(!$this->Res){ switch ($this->dbtype){ case "MSSQL": $emsg = $php_errormsg; break; case "MYSQL": $emsg = @mysql_error(); break; case "PGSQL": case "POSTGRESQL": $emsg = @pg_errormessage(); break; case "ODBC": $emsg = @odbc_errormsg(); break; default: $emsg = ""; break; $this->SetErr('BaseDB.php','BaseDB','°õ¦æSQL»y¥y¥¢±Ñ',$emsg); //echo '1'.$this->Res; return '-1'; } } else{ switch ($this->dbtype){ case "MSSQL": $this->RecordCount = @mssql_num_rows($this->Res); break; case "MYSQL": $this->RecordCount = @mysql_num_rows($this->Res); break; case "PGSQL": case "POSTGRESQL": $this->RecordCount = @pg_num_rows($this->Res); break; case "ODBC": $this->RecordCount = @odbc_num_rows($this->Res); break; default: return -1; } //echo 'sfsfs='.$this->RecordCount ; if($this->RecordCount>0){ $this->EOF=false; $this->RecordNum=0; // return '1'; }else{ $this->EOF=true; $this->RecordCount=0; $this->SetErr('BaseDB.php','BaseDB','','¬d¸ßµL°O¿ý'); // echo '2'.$this->Res; return '0'; }
} } } }
//°õ¦æSQL»y¥y,µLªð¦^µ²ªG¶°. function Exec($strSQL){ if($this->Con!=0){ //echo $strSQL; switch ($this->dbtype){ case "MSSQL": if(!($res=@mssql_query($strSQL,$this->Con))) $emsg = $php_errormsg; break; case "MYSQL": if(!($res = @mysql_query($strSQL,$this->Con))) $emsg = @mysql_error(); break; case "PGSQL": case "POSTGRESQL": if(!($res = @pg_query($this->Con,$strSQL))) $emsg = @pg_errormessage(); break; case "ODBC": if(!($res = @odbc_do($this->Con,$strSQL))) $emsg = @odbc_errormsg(); break; default: $emsg = "µLªkÃѧO¼Æ¾Ú®wÃþ«¬"; $res = false; } if(!$res){ $this->SetErr('BaseDB.php','BaseDB','°õ¦æSQL»y¥y¥¢±Ñ',$emsg); return false; //$this->halt('Execute failed'); } //$this->RecordCount=@mssql_num_rows($this->Res); return true; } else{ $this->SetErr('BaseDB.php','BaseDB','°õ¦æSQL»y¥y¥¢±Ñ',$this->dbtype.' Server ¥¼«Ø¥ß³s±µ'); return false; } }
//±N·í«e°O¿ý©ñ¤J¼Æ²Õ¤¤,¼Æ²Õ¯Á¤ÞȬ°¬ÛÀ³Äæ¦ì¦W¦¨¥¶Ç¦^¼Æ²Õ function GetRow(){ if(!$this->Res){ $this->SetErr('BaseDB.php','BaseDB','Get row failed','ªð¦^QUERYµ²ªG¶°'); return -1; } if(!$this->EOF){ $resu = array(); switch ($this->dbtype){ case "MSSQL":
$count = @mssql_num_fields($this->Res); break; case "MYSQL": $count = @mysql_num_fields($this->Res); break; case "PGSQL": case "POSTGRESQL": $r = @pg_fetch_row($this->Res, 0); $count = count($r); break; case "ODBC": $count = @odbc_num_fields($this->Res); break ; default: $this->SetErr('BaseDB.php','BaseDB','Get row failed','DatabaseÃþ«¬¤£¹ï'); return -1; } if($count==0){ $this->SetErr('BaseDB.php','BaseDB','Get row failed','µLµ²ªG¶°'); return '-1'; } for($i=0;$i<$count;$i++) { switch ($this->dbtype){ case "MSSQL": $resu[strtoupper(@mssql_field_name($this->Res,$i))] = mssql_result($this->Res,$this->RecordNum,mssql_field_name($this->Res,$i)); break; case "MYSQL": $resu[strtoupper(@mysql_field_name($this->Res,$i))] = mysql_result($this->Res,$this->RecordNum,mysql_field_name($this->Res,$i)); break; case "PGSQL": case "POSTGRESQL": $Record = @pg_fetch_row($this->Res, $this->RecordNum); $resu[strtoupper(@pg_field_name($this->Res,$i))] = $Record[$i]; break; case "ODBC": $Record=array(); $r=$this->RecordNum+1; if(phpversion() >= '4.2.0') $stat = @odbc_fetch_into($this->Res, $Record, $r); else $stat = @odbc_fetch_into($this->Res, $r, $Record); if(is_array($r)) $Record=$r; $resu[strtoupper(@odbc_field_name($this->Res,($i+1)))] = $Record[$i]; break; }// echo mssql_field_name($this->Res,$i)."<br>" ; } return $resu; } else{ $this->SetErr('BaseDB.php','BaseDB','Get row failed','ªð¦^µ²ªG¶°¬°ªÅ©ÎµLµ²ªG¶°'); return '-1'; }
}
function GetCount(){ //±o¨ì°O¿ýÓ¼Æ¾Ú return $this->RecordCount; }
function affected_rows() { //¨ú±o°õ¦æSQL»y¥y«á©Ò¤Þ¼vÅT¤§°O¿ý±ø¼Æ // Not a supported function in PHP3/4. Chris Johnson, 16May2001. // return mssql_affected_rows($this->Query_ID); switch ($this->dbtype){ case "MSSQL": $rsRows = @mssql_query("Select @@rowcount as rows", $this->Con); if ($rsRows) { return @mssql_result($rsRows, 0, "rows"); } else{ $this->SetErr('BaseDB.php','BaseDB','Get affected row failed',$php_errormsg); return false; } break; case "MYSQL": return mysql_affected_rows(); case "PGSQL": case "POSTGRESQL": return pg_affected_rows(); case "ODBC": $num_rows = @odbc_num_rows($this->Res); if ($num_rows < 0) { $i=10; while (@odbc_fetch_row($this->Res, $i)) $i*=10;
$j=0; while ($i!=$j) { $k= $j+intval(($i-$j)/2); if (@odbc_fetch_row($this->Res, $k)) $j=$k; else $i=$k; if (($i-$j)==1) { if (@odbc_fetch_row($this->Res, $i)) $j=$i; else $i=$j; }; }; $num_rows=$i; } return $num_rows; default: return 0; } }
function GetField($FieldName){ //¨ú±o¸ÓÄæ¦ì¼Æ¾Ú,¤£«ØÄ³¨Ï¥Î if(!$this->Res){ $this->SetErr('BaseDB.php','BaseDB','Get Field failed','ªð¦^µ²ªG¶°¬°ªÅ'); return false; } else{ if($this->EOF) { $this->SetErr('BaseDB.php','BaseDB','Get Field failed','ªð¦^µ²ªG¶°¬°ªÅ'); return false; } else{ $row=$this->GetRow(); if(is_array($row)){ //echo $FieldName; $Fiel=$row[strtoupper($FieldName)] ; return $Fiel; }else{ if($row==-1) $this->SetErr('BaseDB.php','BaseDB','Get Field failed',$php_errormsg); else $this->SetErr('BaseDB.php','BaseDB','Get Field failed','¬dµL¿é¥X¸ê®Æ'); return false; } if(!$Fiel && $Fiel!=null){ $this->SetErr('BaseDB.php','BaseDB','Get Field failed',$php_errormsg); return false; }else return $Fiel; } } }
function MoveNext(){ //«ü°w¤U²¾ if(!$this->Res){ $this->SetErr('BaseDB.php','BaseDB','Get Field failed','ªð¦^µ²ªG¶°¬°ªÅ'); return false; } if($this->RecordNum>=$this->RecordCount){ $this->SetErr('BaseDB.php','BaseDB','Move Next failed','«ü°w¤w«ü¦V³Ì«á°O¿ý'); return false; } $this->RecordNum=$this->RecordNum+1; //mssql_data_seek($this->Res,$this->RecordNum); if($this->RecordNum>=$this->RecordCount) $this->EOF=true; return true; }
function MoveFirst(){ //«ü°w²¾¨ì³Ì«e if(!$this->Res){ $this->SetErr('BaseDB.php','BaseDB','Move First failed','ªð¦^µ²ªG¶°¬°ªÅ'); return false; } $this->RecordNum=0; //mssql_data_seek($this->Res,$this->RecordNum); if($this->RecordCount>0){ $this->EOF=false; //$this->BOF=true; } return true; }
function MoveLast(){ //«ü°w²¾¨ì³Ì«á if(!$this->Res){ $this->SetErr('BaseDB.php','BaseDB','Move First failed','ªð¦^µ²ªG¶°¬°ªÅ'); return false; } $this->RecordNum=$this->RecordCount; $this->BOF=false; $this->EOF=true; return true; } //«ü°w«e²¾ function MovePrevious(){ if($this->RecordNum==0){ $this->SetErr('BaseDB.php','BaseDB','Move Previous failed','«ü°w¤w«ü¦V²Ä¤@±ø°O¿ý'); return false; } $this->RecordNum=$this->RecordNum-1; if($this->RecordNum==0) $this->BOF=true; if($this->RecordCount>0) $this->EOF=false; return true ; }
function Move($x){ //«ü°w²¾¨ì«ü©w¦ì¸m // echo $this->RecordCount; if(!$this->Res){ $this->SetErr('BaseDB.php','BaseDB','Move First failed','ªð¦^µ²ªG¶°¬°ªÅ'); return false; } if($this->RecordCount<=$x){ $this->SetErr('BaseDB.php','BaseDB','Move failed','n²¾°Ê¤§°O¿ý¼Æ¤w¤j¤_°O¿ýÁ`¼Æ'); return false; } else $this->RecordNum=$x; return true; }
function EOF(){ //§PÂ_«ü°w¬O§_«ü¦Vµ²ªG¶°³Ì«á if($this->EOF) return true; else return false; }
function BOF(){ //§PÂ_«ü°w¬O§_«ü¦Vµ²ªG¶°³Ì«eºÝ if($this->BOF) return true; else return false; } /*************************************************************************************
************************************************************************************ */
function metadata($table) { $count = 0; $id = 0; $res = array(); $id = mssql_query("select * from ".$table, $this->Con); if (!$id) { $this->Errno = 1; $this->Error = "General Error (The MSSQL interface cannot return detailed error messages)."; // $this->halt("Metadata query failed."); } $count = mssql_num_fields($id); for ($i=0; $i<$count; $i++) { $res[$i]["name"]= @mssql_field_name($id,$i); } return $res; }
function SetErr($ErrFile,$ErrClass,$Msg,$Error){ //³]¸m¥X¿ù«H®§ $obj=$this->Err ; if(!is_object($obj)) $this->Err=new Error; $this->Err->ErrFile=$ErrFile; $this->Err->ErrClass=$ErrClass; $this->Err->Msg=$Msg; $this->Err->Error=$Error; return; }
function GetErr(){ //¨ú±o¥X¿ù«H®§Ãþ $obj=$this->Err ; if(is_object($obj)) return $this->Err; else return false; }
function Geterror(){ $obj=$this->Err; if(is_object($obj)) return $this->Err->Error; else return ""; }
} ?>
basecollect.php <? //***************************************************************** // //°òÃþ,Ä~©Ó¤_Babased //¶°¦XÃþ //¥¯à:³Ð«Ø¤Î¨ú±o¶°¦XÃþ¬ÛÀ³ÓÅéÃþ,·s¼W,×§ï,§R°£¬ÛÀ³ÓÅéÃþ°O¿ý // //*****************************************************************
require_once 'BaseDB.php';
class basecollect extends BaseDB {
var $fer="##@@##"; function CreateObj($a){ //³Ð«ØÓÅéÃþ ¥uÃþ¨Ï¥Î,§ùµ´¬É±µ{¦¡¨Ï¥Î $obj=new $a; $obj->parent=$this; $obj->Set_tb_name($a); return $obj; }
function GetObj($a){ //±o¨ì·í«e°O¿ý¤§ÓÅéÃþ ¥uÃþ¨Ï¥Î,§ùµ´¬É±µ{¦¡¨Ï¥Î $ar=$this->GetRow(); if($ar=='0') return '0'; if($ar=='-1') return '-1'; else{ $obj=$this->CreateObj($a); /*for(reset($ar);$key=key($ar);next($ar)) { if(is_string($ar[$key])) $ar[$key]=stripcslashes($ar[$key]); } */ $obj->properties=$ar; $obj->Setkey(); return $obj; } }
function AddSQL($ar,$table){ // ¥uÃþ¨Ï¥Î,§ùµ´¬É±µ{¦¡¨Ï¥Î $sql="insert into ".$table." "; $sql1="("; $sql2=") values("; $arr=$ar; //echo 'fffffffffffffffffffffff' ; for(reset($arr);$key=key($arr);next($arr)) { $sql1=$sql1.$key.","; if(is_string($arr[$key])) { if(strcmp($arr[$key],$this->fer)==0){ //echo $arr[$key].'==='.$key; $this->SetErr('basecollect.php','basecollect','¦sÀÉ¥¢±Ñ',$key.'Äæ¦ì¼Æ¾Ú®æ¦¡¤£¥¿½T'); //echo $this->geterror(); return false; } $value=($arr[$key]); $value=str_replace("'","''",$value); $value=$this->ChgTitle($value); $sql2=$sql2."'".$value."',"; }else { if(strcmp($arr[$key],$this->fer)==0){ $this->SetErr('basecollect.php','basecollect','¦sÀÉ¥¢±Ñ',$key.'Äæ¦ì¼Æ¾Ú®æ¦¡¤£¥¿½T'); return false; } $sql2=$sql2.$arr[$key].","; } } $sql1=substr($sql1,0,strlen($sql1)-1); // ¥h±¼³Ì«á¤@Ó³r¸¹ $sql2=substr($sql2,0,strlen($sql2)-1); // ¥h±¼³Ì«á¤@Ó³r¸¹ $sql2=$sql2.")"; $sql=$sql.$sql1.$sql2; //echo $sql; if(!$this->Exec($sql)){ $this->SetErr('basecollect.php','basecollect','',$key.'SQL»y¥y¥X¿ù!'); return false; }else return true;
}
function ModifySQL($ar,$k,$table){ // ¥uÃþ¨Ï¥Î,§ùµ´¬É±µ{¦¡¨Ï¥Î $sql="update ".$table." set "; $arr=$ar; for(reset($arr);$key=key($arr);next($arr)) { // for(reset($k);$key1=key($k);next($k)) // { // if(!strcmp($key,$key1)==0){ if(is_string($arr[$key])) { if(strcmp($arr[$key],$this->fer)==0){ $this->SetErr('basecollect.php','basecollect','¦sÀÉ¥¢±Ñ',$key.'Äæ¦ì¼Æ¾Ú®æ¦¡¤£¥¿½T'); return false; } $value=($arr[$key]); $value=str_replace("'","''",$value); $value=$this->ChgTitle($value); $sql=$sql.$key."='".$value."', "; }else { if(strcmp($arr[$key],$this->fer)==0){ $this->SetErr('basecollect.php','basecollect','¦sÀÉ¥¢±Ñ',$key.'Äæ¦ì¼Æ¾Ú®æ¦¡¤£¥¿½T'); return false; } $sql=$sql.$key."=".$arr[$key].", "; } // } // } } $sql=substr($sql,0,strlen($sql)-2); $sql=$sql." where "; if(count($k)==0){ $this->SetErr('basecollect.php','basecollect','¦sÀÉ¥¢±Ñ','µLÃöÁäÄæ¦ì'); return false; } for(reset($k);$key=key($k);next($k)) {
if(is_string($k[$key])) { if(strcmp($k[$key],$this->fer)==0){ $this->SetErr('basecollect.php','basecollect','¦sÀÉ¥¢±Ñ',$key.'Äæ¦ì¼Æ¾Ú®æ¦¡¤£¥¿½T'); return false; } //$value=stripslashes($k[$key]); //$value=str_replace("'","''",$value); $sql=$sql.$key."='".$k[$key]."' and ";
}else { if(strcmp($k[$key],$this->fer)==0){ $this->SetErr('basecollect.php','basecollect','¦sÀÉ¥¢±Ñ',$key.'Äæ¦ì¼Æ¾Ú®æ¦¡¤£¥¿½T'); return false; } $sql=$sql.$key."=".$k[$key]." and "; } } //echo $sql; $sql=substr($sql,0,strlen($sql)-4); //echo '<br>Modify=='.$sql; // echo $sql; if(!$this->Exec($sql)){ $this->SetErr('basecollect.php','basecollect','',$key.'SQL»y¥y¥X¿ù!'); return false; }else return true; }
function DeleteSQL($k,$table){ // ¥uÃþ¨Ï¥Î,§ùµ´¬É±µ{¦¡¨Ï¥Î $sql="delete ".$table." where "; $arr=array(); $arr=$k; for(reset($arr);$key=key($arr);next($arr)) { if(strcmp($arr[$key],$this->fer)==0){ //$this->Err->Error=$key."Äæ¦ì¼Æ¾Ú®æ¦¡¤£¥¿½T"; $this->SetErr('basecollect.php','basecollect','¦sÀÉ¥¢±Ñ',$key.'Äæ¦ì¼Æ¾Ú®æ¦¡¤£¥¿½T'); return false; } if(is_string($arr[$key])) { $sql=$sql.$key."='".$arr[$key]."' and "; }else { $sql=$sql.$key."=".$arr[$key]." and "; } } $sql=substr($sql,0,strlen($sql)-4); // $this->Exec($sql);
if(!$this->Exec($sql)){ $this->SetErr('basecollect.php','basecollect','',$key.'SQL»y¥y¥X¿ù!'); return false; }else return true; }
function ChgTitle($title) { $length=mb_strlen($title) ; $b=mb_substr($title,($length-1),1); if(ord($b)>128 && strlen($b)==1) $title=mb_substr($title,0,($length-1)) ; return $title; }
}
?>
|
|
|