Viewing file:      da_sa_club.php (2.33 KB)      -rwxr-xr-x Select action/file-type:    (+) |   (+) |   (+) | Code (+) | Session (+) |   (+) | SDB (+) |   (+) |   (+) |   (+) |   (+) |   (+) |
 
<?php
 
 include_once("sa_model.php");
 
 class Da_sa_club extends Sa_model {        
     
     // PK is cl_id
     
     public $cl_id;
     public $cl_seq;
     public $cl_code;
     public $cl_name;
     public $cl_name_eng;
     public $cl_min_membership;
     public $cl_max_membership;
     public $cl_due;
     public $cl_smo_id;
     public $cl_fr_date;
     public $cl_to_date;
     public $cl_av_id;
 
     public $last_insert_id;
 
     public $prs_name;
     public $prs_surname;
     function Da_sa_club() {
         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_club (cl_id, cl_seq, cl_code, cl_name, cl_name_eng, cl_min_membership, cl_max_membership, cl_due, cl_smo_id, cl_fr_date, cl_to_date, cl_av_id)
                 VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
         $this->db->query($sql, array($this->cl_id, $this->cl_seq, $this->cl_code, $this->cl_name, $this->cl_name_eng, $this->cl_min_membership, $this->cl_max_membership, $this->cl_due, $this->cl_smo_id, $this->cl_fr_date, $this->cl_to_date, $this->cl_av_id));
         $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_club 
                 SET    cl_seq=?, cl_code=?, cl_name=?, cl_name_eng=?, cl_min_membership=?, cl_max_membership=?, cl_due=?, cl_smo_id=?, cl_fr_date=?, cl_to_date=?, cl_av_id=? 
                 WHERE cl_id=?";    
         $this->db->query($sql, array($this->cl_seq, $this->cl_code, $this->cl_name, $this->cl_name_eng, $this->cl_min_membership, $this->cl_max_membership, $this->cl_due, $this->cl_smo_id, $this->cl_fr_date, $this->cl_to_date, $this->cl_av_id, $this->cl_id));    
     }
     
     function delete() {
         // if there is no primary key, please remove WHERE clause.
         $sql = "DELETE FROM  $this->sa_dbname.sa_club
                 WHERE cl_id=?";
         $this->db->query($sql, array($this->cl_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_club 
                 WHERE cl_id=?";
         $query = $this->db->query($sql, array($this->cl_id));
         if ( $withSetAttributeValue ) {
             $this->row2attribute( $query->row() );
         } else {
             return $query ;
         }
     }
     
 }     //=== end class Da_sa_club
 ?>
  |