Viewing file: clsCollegeDetail.php (2.32 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//--Class collegedetail--------------------------
//--PK of collegedetail ::
// 1. collegeID
include_once "../link/keyThai.php";
class collegedetail extends clsDB{
var $result;
var $cID;
var $collegeID;
var $collegeName;
var $collegeAbbr;
var $collegeHost;
var $collegeType;
function collegedetail(&$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 collegedetail values(
'".th2a($this->cID)."',
'".th2a($this->collegeID)."',
'".th2a($this->collegeName)."',
'".th2a($this->collegeAbbr)."',
'".th2a($this->collegeHost)."',
'".th2a($this->collegeType)."')";
}else {
$sql = "update collegedetail set
collegeID='".th2a($this->collegeID)."',
collegeName='".th2a($this->collegeName)."',
collegeAbbr='".th2a($this->collegeAbbr)."',
collegeHost='".th2a($this->collegeHost)."',
collegeType='".th2a($this->collegeType)."'
where cID='".th2a($this->cID)."'";
}
return $this->Dml($sql);
}
function Delete(){
return $this->Dml("delete from collegedetail where collegeID='$this->collegeID'");
}
function GetNextCode(){
$this->SetQuery("select max(cID) as num from collegedetail");
if ($result=$this->GetResult()) {
return $result['num']+1;
}
}
function RScollegedetail(){
$this->SetQuery("select * from collegedetail order by cID");
}
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->collegeName=a2th($this->collegeName);
}
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 collegedetail where collegeID= '$xKey'")){
return 1;
}else {
return 0;
}
}
//****************** You can add new functions below **********************//
function RScollegeSR($xKey){
$this->SetQuery("select * from collegedetail where collegeID!='$xKey' and collegeType='Y' order by cID");
}
} //--End class collegedetail--
?>
|