Viewing file: clsadmin.php (1.41 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php class admin extends clsDB{
var $result; var $adminId; var $adminName;
function admin(&$c){ $this->c=$c->c; $this->DB=$c->db; } function AddNew(){ $this->status = 1; }
function Edit(){ $this->status = 2; }
function Save(){ if ($this->status==1){ $sql = "insert into Admin values('$this->adminId', '$this->adminName')"; }else { $sql = "update Admin set adminName='$this->adminName' where adminId='$this->adminId'"; } return $this->Dml($sql); }
function Delete(){ return $this->Dml("delete from Admin where adminId='$this->adminId'"); }
function GetNextCode(){ $this->SetQuery("select max(adminId) as num from admin"); if ($result=$this->GetResult()) { return $result['num']+1; } } function RSadmin(){ $this->SetQuery("select * from Admin order by adminId"); } function GetRecord(){ $numFields = $this->NumField(); $row = $this->GetResult(); if ($row){ for ($i=0; $i<$numFields; $i++){ eval("\$this->".mysql_field_name($this->rs, $i)."=\$row['".mysql_field_name($this->rs, $i)."'];"); } return true; }else{ // clear value of Member; for ($i=0; $i<$numFields; $i++){ eval("\$this->".mysql_field_name($this->rs, $i)."='';"); } return false; } } function SearchByKey($xKey){ if ($this->SetQuery("select * from Admin where adminId= '$xKey'")){ return 1; }else { return 0; } } //****************** You can add new functions below **********************// } //--End class base_DocSpeedLevel-- ?>
|