Viewing file:      da_sa_member.php (2.13 KB)      -rwxr-xr-x Select action/file-type:    (+) |   (+) |   (+) | Code (+) | Session (+) |   (+) | SDB (+) |   (+) |   (+) |   (+) |   (+) |   (+) |
 
<?php
 
 include_once("sa_model.php");
 
 class Da_sa_member extends Sa_model {        
     
     // PK is mb_id
     
     public $mb_id;
     public $mb_smo_id;
     public $mb_cl_id;
     public $mb_mpj_id;
     public $mb_acp_id;
     public $mb_std_id;
     public $mb_year;
     public $mb_tmId;
     public $mb_syId;
     public $mb_fr_date;
     public $mb_to_date;
 
     public $last_insert_id;
 
     function __construct() {
         parent::__construct();
         $this->load->database('esa',TRUE);
     }
     
     function insert() {
         // if there is no auto_increment field, please remove it
         $sql = "INSERT INTO $this->sa_dbname.sa_member (mb_id, mb_smo_id, mb_cl_id, mb_mpj_id, mb_acp_id, mb_std_id, mb_year, mb_tmId, mb_syId, mb_fr_date, mb_to_date)
                 VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
         $this->db->query($sql, array($this->mb_id, $this->mb_smo_id, $this->mb_cl_id, $this->mb_mpj_id, $this->mb_acp_id, $this->mb_std_id, $this->mb_year, $this->mb_tmId, $this->mb_syId, $this->mb_fr_date, $this->mb_to_date));
         $this->last_insert_id = $this->db->insert_id();
     }
     
     function update() {
         // if there is no primary key, please remove WHERE clause.
         $sql = "UPDATE $this->sa_dbname.sa_member 
                 SET    mb_smo_id=?, mb_cl_id=?, mb_mpj_id=?, mb_acp_id=?, mb_std_id=?, mb_year=?, mb_tmId=?, mb_syId=?, mb_fr_date=?, mb_to_date=? 
                 WHERE mb_id=?";    
         $this->db->query($sql, array($this->mb_smo_id, $this->mb_cl_id, $this->mb_mpj_id, $this->mb_acp_id, $this->mb_std_id, $this->mb_year, $this->mb_tmId, $this->mb_syId, $this->mb_fr_date, $this->mb_to_date, $this->mb_id));    
     }
     
     function delete() {
         // if there is no primary key, please remove WHERE clause.
         $sql = "DELETE FROM $this->sa_dbname.sa_member
                 WHERE mb_id=?";
         $this->db->query($sql, array($this->mb_id));
     }
     
     /*
      * You have to assign primary key value before call this function.
      */
     function get_by_key($withSetAttributeValue=FALSE) {    
         $sql = "SELECT * 
                 FROM $this->sa_dbname.sa_member 
                 WHERE mb_id=?";
         $query = $this->db->query($sql, array($this->mb_id));
         if ( $withSetAttributeValue ) {
             $this->row2attribute( $query->row() );
         } else {
             return $query ;
         }
     }
     
 }     //=== end class Da_sa_member
 ?>
  |