Viewing file: da_sa_member_sc.php (1.73 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once("sa_model.php");
class Da_sa_member_sc extends Sa_model {
// PK is mbs_id
public $mbs_id;
public $mbs_sc_id;
public $mbs_std_id;
public $mbs_year;
public $mbs_fr_date;
public $mbs_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 sa_member_sc (mbs_id, mbs_sc_id, mbs_std_id, mbs_year, mbs_fr_date, mbs_to_date)
VALUES(?, ?, ?, ?, ?, ?)";
$this->db->query($sql, array($this->mbs_id, $this->mbs_sc_id, $this->mbs_std_id, $this->mbs_year, $this->mbs_fr_date, $this->mbs_to_date));
$this->last_insert_id = $this->db->insert_id();
}
function update() {
// if there is no primary key, please remove WHERE clause.
$sql = "UPDATE sa_member_sc
SET mbs_sc_id=?, mbs_std_id=?, mbs_year=?, mbs_fr_date=?, mbs_to_date=?
WHERE mbs_id=?";
$this->db->query($sql, array($this->mbs_sc_id, $this->mbs_std_id, $this->mbs_year, $this->mbs_fr_date, $this->mbs_to_date, $this->mbs_id));
}
function delete() {
// if there is no primary key, please remove WHERE clause.
$sql = "DELETE FROM sa_member_sc
WHERE mbs_id=?";
$this->db->query($sql, array($this->mbs_id));
}
/*
* You have to assign primary key value before call this function.
*/
function get_by_key($withSetAttributeValue=FALSE) {
$sql = "SELECT *
FROM sa_member_sc
WHERE mbs_id=?";
$query = $this->db->query($sql, array($this->mbs_id));
if ( $withSetAttributeValue ) {
$this->row2attribute( $query->row() );
} else {
return $query ;
}
}
} //=== end class Da_sa_member_sc
?>
|