Viewing file:      da_persont.php (6.6 KB)      -rwxr-xr-x Select action/file-type:    (+) |   (+) |   (+) | Code (+) | Session (+) |   (+) | SDB (+) |   (+) |   (+) |   (+) |   (+) |   (+) |
 
<?php
 include_once("ppc_model.php");
 
 class Da_persont extends Ppc_model {
     
     // PK is personId
     
     public $personId;
     public $idCard;
     public $taxId;
     public $fName2;
     public $lName2;
     public $personstatusId;
     public $sex;
     public $startDate;
     public $practicDate;
     public $degreeadId;
     public $educmajoradId;
     public $birthProvince;
     public $birthDate;
     public $bloodId;
     public $highPsn;
     public $weightPsn;
     public $religionId;
     public $raceId;
     public $nationId;
     public $o1prefixId;
     public $o1fName;
     public $o1lName;
     public $o2prefixId;
     public $o2fName;
     public $o2lName;
     public $addrt1;
     public $addrt2;
     public $provinceId1;
     public $amphurId1;
     public $districtId1;
     public $zipCode1;
     public $provinceId2;
     public $districtId2;
     public $zipCode2;
     public $lodgeId;
     public $lodgeNo;
     public $lodgePhone;
     public $homePhone;
     public $mobilePhone;
     public $workPhone;
     public $exPhone;
     public $sixtyDate;
     public $pensionDate;
     public $pensionYear;
     public $emailAddr;
     public $kType;
     public $kDate;
     public $moral;
     public $interest;
     public $vocationNo;
     public $pic;
     public $chvilai;
     public $waterNo;
     public $cType;
     public $cNo;
     public $electricId;
     public $telephoneId;
     public $tosType;
     public $tosId;
     public $rentHome;
     public $amphurId2;
     public $kNo;
     public $bksaveType;
     public $bksaveNo;
     public $StoreType;
     public $StoreNo;
     public $cksType;
     public $cksNo;
 
     public $last_insert_id;
 
     function Da_persont() {
         parent::__construct();
         $this->load->database('ppc',TRUE);
     }
     
     function insert() {
         // if there is no auto_increment field, please remove it
         $sql = "INSERT INTO $this->ppc_dbname.PersonT (personId, idCard, taxId, fName2, lName2, personstatusId, sex, startDate, practicDate, degreeadId, educmajoradId, birthProvince, birthDate, bloodId, highPsn, weightPsn, religionId, raceId, nationId, o1prefixId, o1fName, o1lName, o2prefixId, o2fName, o2lName, addrt1, addrt2, provinceId1, amphurId1, districtId1, zipCode1, provinceId2, districtId2, zipCode2, lodgeId, lodgeNo, lodgePhone, homePhone, mobilePhone, workPhone, exPhone, sixtyDate, pensionDate, pensionYear, emailAddr, kType, kDate, moral, interest, vocationNo, pic, chvilai, waterNo, cType, cNo, electricId, telephoneId, tosType, tosId, rentHome, amphurId2, kNo, bksaveType, bksaveNo, StoreType, StoreNo, cksType, cksNo)
                 VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
         $this->db->query($sql, array($this->personId, $this->idCard, $this->taxId, $this->fName2, $this->lName2, $this->personstatusId, $this->sex, $this->startDate, $this->practicDate, $this->degreeadId, $this->educmajoradId, $this->birthProvince, $this->birthDate, $this->bloodId, $this->highPsn, $this->weightPsn, $this->religionId, $this->raceId, $this->nationId, $this->o1prefixId, $this->o1fName, $this->o1lName, $this->o2prefixId, $this->o2fName, $this->o2lName, $this->addrt1, $this->addrt2, $this->provinceId1, $this->amphurId1, $this->districtId1, $this->zipCode1, $this->provinceId2, $this->districtId2, $this->zipCode2, $this->lodgeId, $this->lodgeNo, $this->lodgePhone, $this->homePhone, $this->mobilePhone, $this->workPhone, $this->exPhone, $this->sixtyDate, $this->pensionDate, $this->pensionYear, $this->emailAddr, $this->kType, $this->kDate, $this->moral, $this->interest, $this->vocationNo, $this->pic, $this->chvilai, $this->waterNo, $this->cType, $this->cNo, $this->electricId, $this->telephoneId, $this->tosType, $this->tosId, $this->rentHome, $this->amphurId2, $this->kNo, $this->bksaveType, $this->bksaveNo, $this->StoreType, $this->StoreNo, $this->cksType, $this->cksNo));
         $this->last_insert_id = $this->db->insert_id();
     }
     
     function update() {
         // if there is no primary key, please remove WHERE clause.
         $sql = "UPDATE $this->ppc_dbname.PersonT 
                 SET    idCard=?, taxId=?, fName2=?, lName2=?, personstatusId=?, sex=?, startDate=?, practicDate=?, degreeadId=?, educmajoradId=?, birthProvince=?, birthDate=?, bloodId=?, highPsn=?, weightPsn=?, religionId=?, raceId=?, nationId=?, o1prefixId=?, o1fName=?, o1lName=?, o2prefixId=?, o2fName=?, o2lName=?, addrt1=?, addrt2=?, provinceId1=?, amphurId1=?, districtId1=?, zipCode1=?, provinceId2=?, districtId2=?, zipCode2=?, lodgeId=?, lodgeNo=?, lodgePhone=?, homePhone=?, mobilePhone=?, workPhone=?, exPhone=?, sixtyDate=?, pensionDate=?, pensionYear=?, emailAddr=?, kType=?, kDate=?, moral=?, interest=?, vocationNo=?, pic=?, chvilai=?, waterNo=?, cType=?, cNo=?, electricId=?, telephoneId=?, tosType=?, tosId=?, rentHome=?, amphurId2=?, kNo=?, bksaveType=?, bksaveNo=?, StoreType=?, StoreNo=?, cksType=?, cksNo=? 
                 WHERE personId=?";    
         $this->db->query($sql, array($this->idCard, $this->taxId, $this->fName2, $this->lName2, $this->personstatusId, $this->sex, $this->startDate, $this->practicDate, $this->degreeadId, $this->educmajoradId, $this->birthProvince, $this->birthDate, $this->bloodId, $this->highPsn, $this->weightPsn, $this->religionId, $this->raceId, $this->nationId, $this->o1prefixId, $this->o1fName, $this->o1lName, $this->o2prefixId, $this->o2fName, $this->o2lName, $this->addrt1, $this->addrt2, $this->provinceId1, $this->amphurId1, $this->districtId1, $this->zipCode1, $this->provinceId2, $this->districtId2, $this->zipCode2, $this->lodgeId, $this->lodgeNo, $this->lodgePhone, $this->homePhone, $this->mobilePhone, $this->workPhone, $this->exPhone, $this->sixtyDate, $this->pensionDate, $this->pensionYear, $this->emailAddr, $this->kType, $this->kDate, $this->moral, $this->interest, $this->vocationNo, $this->pic, $this->chvilai, $this->waterNo, $this->cType, $this->cNo, $this->electricId, $this->telephoneId, $this->tosType, $this->tosId, $this->rentHome, $this->amphurId2, $this->kNo, $this->bksaveType, $this->bksaveNo, $this->StoreType, $this->StoreNo, $this->cksType, $this->cksNo, $this->personId));    
     }
     
     function delete() {
         // if there is no primary key, please remove WHERE clause.
         $sql = "DELETE FROM $this->ppc_dbname.PersonT
                 WHERE personId=?";
         $this->db->query($sql, array($this->personId));
     }
     
     /*
      * You have to assign primary key value before call this function.
      */
     function get_by_key($withSetAttributeValue=FALSE) {    
         $sql = "SELECT * 
                 FROM $this->ppc_dbname.PersonT 
                 WHERE personId=?";
         $query = $this->db->query($sql, array($this->personId));
         if ( $withSetAttributeValue ) {
             $this->row2attribute( $query->row() );
         } else {
             return $query ;
         }
     }
 
   function last_insert_id(){
         return $this->db->insert_id();
     }
     
 }     //=== end class Da_persont
 ?>
  |