Viewing file: clsCollegeDetail.php (3.75 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;
var $collegeqCID;
var $collegecUID;
var $pdId;
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)."',
'".th2a($this->collegeqCID)."',
'".th2a($this->collegecUID)."',
'".th2a($this->pdId)."')";
}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)."',
collegeqCID='".th2a($this->collegeqCID)."',
collegecUID='".th2a($this->collegecUID)."',
pdId='".th2a($this->pdId)."'
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' and collegeHost!='' order by collegeqCID asc, collegecUID asc");
}
function RScollegeSRordercollegeqCIDcollegecUID($xKey){
$this->SetQuery("select * from collegedetail where collegeID!='$xKey' and collegeType='Y' and collegeHost!='' order by collegeqCID asc, collegecUID asc");
}
function RScollegeSR2($xKey){
$this->SetQuery("select collegeID,collegeName from collegedetail where collegeID!='$xKey' and collegeType='Y' and collegeHost!='' order by collegeqCID asc, collegecUID asc");
}
function SearchUsed($name,$valuecheck){
$this->SetQuery("select count($name) as num from collegedetail where $name='$valuecheck' ");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function RScollegedetailnotMe($xKey){
$this->SetQuery("select * from collegedetail where collegeID!='$xKey' order by collegeqCID asc, collegecUID asc");
}
function SearchpdIdpbri($collegeID){
$this->SetQuery("select pdId as num from collegedetail where collegeID='$collegeID' ");
if ($result=$this->GetResult()) {
return $result['num'];
}
}
function RScollegedetail_mobile(){
mysql_query("SET NAMES TIS620");
$this->SetQuery("select * from collegedetail order by cID");
}
} //--End class collegedetail--
?>
|