Viewing file: _da_sa_military.php (2.39 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once("sa_model.php");
class Da_sa_military extends Sa_model {
// PK is mil_id
public $mil_id;
public $mil_std_id;
public $mil_rt_id;
public $mil_ecp_id;
public $mil_served_as;
public $mil_fr_year;
public $mil_to_year;
public $mil_create_date;
public $mil_create_us_login;
public $mil_update_date;
public $mil_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_military (mil_id, mil_std_id, mil_rt_id, mil_ecp_id, mil_served_as, mil_fr_year, mil_to_year, mil_create_date, mil_create_us_login, mil_update_date, mil_update_us_login)
VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
$this->db->query($sql, array($this->mil_id, $this->mil_std_id, $this->mil_rt_id, $this->mil_ecp_id, $this->mil_served_as, $this->mil_fr_year, $this->mil_to_year, $this->mil_create_date, $this->mil_create_us_login, $this->mil_update_date, $this->mil_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_military
SET mil_std_id=?, mil_rt_id=?, mil_ecp_id=?, mil_served_as=?, mil_fr_year=?, mil_to_year=?, mil_create_date=?, mil_create_us_login=?, mil_update_date=?, mil_update_us_login=?
WHERE mil_id=?";
$this->db->query($sql, array($this->mil_std_id, $this->mil_rt_id, $this->mil_ecp_id, $this->mil_served_as, $this->mil_fr_year, $this->mil_to_year, $this->mil_create_date, $this->mil_create_us_login, $this->mil_update_date, $this->mil_update_us_login, $this->mil_id));
}
function delete() {
// if there is no primary key, please remove WHERE clause.
$sql = "DELETE FROM $this->sa_dbname.sa_military
WHERE mil_id=?";
$this->db->query($sql, array($this->mil_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_military
WHERE mil_id=?";
$query = $this->db->query($sql, array($this->mil_id));
if ( $withSetAttributeValue ) {
$this->row2attribute( $query->row() );
} else {
return $query ;
}
}
} //=== end class Da_sa_military
?>
|