Viewing file: clsadmin.php (1.58 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//--Class base_admin--------------------------
//--PK of base_admin ::
// 1. adminId
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--
?>
|