Viewing file: clsSectionRQ.php (3.54 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//--Class SectionRQ--------------------------
//--PK of SectionRQ ::
// 1. sectionRQid
//include_once "clsDB.php";
class SectionRQ extends clsDB{
var $result;
var $sectionRQid;
var $assid;
var $topicSectionRQ;
var $sequenceRQ;
function SectionRQ(&$c){
$this->c=$c->c;
$this->DB=$c->db;
}
function Save(){
//--гЄйаБёНґ№ХйаБЧиНµйН§ЎТГєС№·ЦЎўйНБЩЕг№НкНєаЁкЎаўйТКЩи°Т№ўйНБЩЕ
//--вґВЁРµГЗЁКНєК¶Т№РўН§ўйНБЩЕЗиТўйНБЩЕг№НкНєаЁкЎа»з№ўйНБЩЕгЛБиЛГЧНўйНБЩЕаґФБ
//--1 а»з№ўйНБЩЕгЛБи 2 а»з№ўйНБЩЕаґФБ
if ($this->status==1){
//uncomment a line below if your table use ID as running number
$this->sectionRQid=$this->GetNextCode();
//$this->sequenceRQ ЁРКи§БТЁТЎ¤иТўН§ numSRQ+1;
$sql = "insert into SectionRQ values(
'$this->sectionRQid',
'$this->assid',
'$this->topicSectionRQ',
'$this->sequenceRQ'
)";
}else {
$sql = "update SectionRQ set
topicSectionRQ='$this->topicSectionRQ',
sequenceRQ='$this->sequenceRQ'
where sectionRQid='$this->sectionRQid' and assid='$this->assid'";
}
//echo "<br><br> SectionRQ Sql => ".$sql;
return $this->Dml($sql);
}
function Delete(){
//--гЄйаБёНґ№ХйаѕЧиНЕєўйНБЩЕаґФБг№НкНєаЁкЎ
//--а»з№ЎТГЕєўйНБЩЕ·ХЕР 1 аГ¤НГмґ
//--µйН§аГХВЎаБёНґµТБЕУґСєґС§№Хй SearchByKey()-->GetRecord()-->Delete()
return $this->Dml("delete from SectionRQ where sectionRQid='$this->sectionRQid'");
}
function GetNextCode(){
//--гЄйаБёНґ№ХйаѕЧиНЛТ¤иТКЩ§КШґўН§їФЕґм·ХигЄйа»з№¤ХВмўН§µТГТ§ г№ЕСЎЙіР auto increment
//--µйН§а»з№їФЕґм·ХидБидґйЎУЛ№ґГЛСКаН§·Т§ЁНАТѕ
$this->SetQuery("select max(sectionRQid) as num from SectionRQ");
if ($result=$this->GetResult()) {
return $result['num']+1;
}
}
function RSSectionRQ(){
//--аБёНґ·ХиўЦ鹵鹴йЗВ RS (Result Set) БХ¤ЗТБЛБТВЗиТЁРдґйГСєўйНБЩЕЎЕСєБТЁТЎЎТГ select БТЎЎЗиТ 1 аГ¤НГмґ
//--»ЎµФаБЧиНаГХВЎгЄйаБёНґ RSxxxx ЁРµйН§аГХВЎаБёНґ GetRecord() ґйЗВаКБН
//--вґВКТБТГ¶аѕФиБаБёНґдґйµТБµйН§ЎТГ бµиµйН§ўЦ鹵鹴йЗВ RS
$this->SetQuery("select * from SectionRQ order by sectionRQid");
}
function GetRecord(){
//--а»з№аБёНґ·Хи№УўйНБЩЕЁТЎ ResultSet БТЎУЛ№ґгЛйЎСєбНµ·ГФєФЗµмўН§НкНєаЁзЎ
//--аГХВЎ GetRecord() Л№Ц觤ГСй§ ЁРаЕЧиН№µСЗЄХйаГ¤НГмґд»НХЎЛ№Ци§аГ¤НГмґ
if ($this->result = $this->GetResult()) {
$this->sectionRQid = $this->result['sectionRQid'];
$this->assid = $this->result['assid'];
$this->topicSectionRQ = $this->result['topicSectionRQ'];
$this->sequenceRQ = $this->result['sequenceRQ'];
return 1;
}else {
return 0;
}
}
function SearchByKey($xKey){
//--гЄйаБёНґ№ХйаѕЧиН¤й№ЛТўйНБЩЕµТБ PK µйН§ГРєШѕТГТБФаµНГмґйЗВ
//--бЕРµйН§µТБґйЗВаБёНґ GetRecord() аКБН
if ($this->SetQuery("select * from SectionRQ where sectionRQid= '$xKey'")){
return 1;
}else {
return 0;
}
}
//****************** You can add new functions below **********************//
function RSSectionAllByAssid($xKey){
if ($this->SetQuery("select * from SectionRQ where assid= '$xKey'")){
return 1;
}else {
return 0;
}
}
function RSSectionRQAll($xKey1,$xKey2){
if ($this->SetQuery("select * from SectionRQ where assid= '$xKey1' and sectionRQid = '$xKey2'")){
return 1;
}else {
return 0;
}
}
function RSCountSectionRQ($xKey){
$this->SetQuery("select count(*) as num from SectionRQ where assid = '$xKey'");
$result = $this->GetResult();
return $result['num'];
}
function RSCountSectionRQByAssidLevel($xassid,$xlevel){
$this->SetQuery("select count(*) as num from SectionRQ where assid = '$xassid' and level = '$xlevel'");
$result = $this->GetResult();
return $result['num'];
}
} //--End class SectionRQ--
?>
|