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