Viewing file: clsannounceDocType.php (1.8 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once "../link/keyThai.php";
class announceDocType extends clsDB{
var $result;
var $AnID;
var $AnName;
function announceDocType(&$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 announceDocType values('".th2a($this->AnID)."', '".th2a($this->AnName)."')";
}else {
$sql = "update announceDocType set AnName='".th2a($this->AnName)."' where AnID='".th2a($this->AnID)."'";
}
return $this->Dml($sql);
}
function Delete(){
return $this->Dml("delete from announceDocType where AnID='$this->AnID'");
}
function GetNextCode(){
$this->SetQuery("select max(AnID) as num from announceDocType");
if ($result=$this->GetResult()) {
return $result['num']+1;
}
}
function RSannounceDocType(){
$this->SetQuery("select * from announceDocType order by AnID");
}
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)."'];");
$this->AnName=a2th($this->AnName);
}
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 announceDocType where AnID= '$xKey'")){
return 1;
}else {
return 0;
}
}
function SearchByKeylimit(){
if ($this->SetQuery("select * from announceDocType order by AnID asc limit 1")){
return 1;
}else {
return 0;
}
}
//****************** You can add new functions below **********************//
} //--End class base_DocSpeedLevel--
?>
|