Viewing file:      da_sa_rodo.php (2.21 KB)      -rwxr-xr-x Select action/file-type:    (+) |   (+) |   (+) | Code (+) | Session (+) |   (+) | SDB (+) |   (+) |   (+) |   (+) |   (+) |   (+) |
 
<?php
  include_once("sa_model.php");
  class Da_sa_rodo extends Sa_model {          // PK is rd_id          public $rd_id;     public $rd_std_id;     public $rd_grade;     public $rd_date;     public $rd_fr_time;     public $rd_to_time;     public $rd_place;     public $rd_create_date;     public $rd_create_us_login;     public $rd_update_date;     public $rd_update_us_login;
      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_rodo (rd_id, rd_std_id, rd_grade, rd_date, rd_fr_time, rd_to_time, rd_place, rd_create_date, rd_create_us_login, rd_update_date, rd_update_us_login)                 VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";         $this->db->query($sql, array($this->rd_id, $this->rd_std_id, $this->rd_grade, $this->rd_date, $this->rd_fr_time, $this->rd_to_time, $this->rd_place, $this->rd_create_date, $this->rd_create_us_login, $this->rd_update_date, $this->rd_update_us_login));         $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_rodo                  SET    rd_std_id=?, rd_grade=?, rd_date=?, rd_fr_time=?, rd_to_time=?, rd_place=?, rd_create_date=?, rd_create_us_login=?, rd_update_date=?, rd_update_us_login=?                  WHERE rd_id=?";             $this->db->query($sql, array($this->rd_std_id, $this->rd_grade, $this->rd_date, $this->rd_fr_time, $this->rd_to_time, $this->rd_place, $this->rd_create_date, $this->rd_create_us_login, $this->rd_update_date, $this->rd_update_us_login, $this->rd_id));         }          function delete() {         // if there is no primary key, please remove WHERE clause.         $sql = "DELETE FROM $this->sa_dbname.sa_rodo                 WHERE rd_id=?";         $this->db->query($sql, array($this->rd_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_rodo                  WHERE rd_id=?";         $query = $this->db->query($sql, array($this->rd_id));         if ( $withSetAttributeValue ) {             $this->row2attribute( $query->row() );         } else {             return $query ;         }     }      }     //=== end class Da_sa_rodo ?> 
  |