Viewing file: da_rs_academic_position.php (1.8 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once("ppc_model.php");
class Da_rs_academic_position extends Ppc_model {
// PK is acp_id
public $acp_id;
public $acp_name_th;
public $acp_name_en;
public $acp_abbr_th;
public $acp_abbr_en;
public $acp_seq;
public $last_insert_id;
function __construct() {
parent::__construct();
$this->db = $this->load->database('ppc',TRUE);
}
function insert() {
// if there is no auto_increment field, please remove it
$sql = "INSERT INTO rs_academic_position (acp_id, acp_name_th, acp_name_en, acp_abbr_th, acp_abbr_en, acp_seq)
VALUES(?, ?, ?, ?, ?, ?)";
$this->db->query($sql, array($this->acp_id, $this->acp_name_th, $this->acp_name_en, $this->acp_abbr_th, $this->acp_abbr_en, $this->acp_seq));
$this->last_insert_id = $this->db->insert_id();
}
function update() {
// if there is no primary key, please remove WHERE clause.
$sql = "UPDATE rs_academic_position
SET acp_name_th=?, acp_name_en=?, acp_abbr_th=?, acp_abbr_en=?, acp_seq=?
WHERE acp_id=?";
$this->db->query($sql, array($this->acp_name_th, $this->acp_name_en, $this->acp_abbr_th, $this->acp_abbr_en, $this->acp_seq, $this->acp_id));
}
function delete() {
// if there is no primary key, please remove WHERE clause.
$sql = "DELETE FROM rs_academic_position
WHERE acp_id=?";
$this->db->query($sql, array($this->acp_id));
}
/*
* You have to assign primary key value before call this function.
*/
function get_by_key($withSetAttributeValue=FALSE) {
$sql = "SELECT *
FROM rs_academic_position
WHERE acp_id=?";
$query = $this->db->query($sql, array($this->acp_id));
if ( $withSetAttributeValue ) {
$this->row2attribute( $query->row() );
} else {
return $query ;
}
}
} //=== end class Da_rs_academic_position
?>
|