Viewing file: da_sa_strategic_project.php (1.76 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once("sa_model.php");
class Da_sa_strategic_project extends Sa_model {
// PK is stp_id
public $stp_id;
public $stp_mpj_id;
public $stp_stg_id;
public $stp_strategy;
public $stp_goal;
public $last_insert_id;
function Da_sa_strategic() {
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_strategic_project (stp_id, stp_mpj_id, stp_stg_id, stp_strategy, stp_goal)
VALUES(?, ?, ?, ?, ?)";
$this->db->query($sql, array($this->stp_id, $this->stp_mpj_id, $this->stp_stg_id, $this->stp_strategy, $this->stp_goal));
$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_strategic_project
SET stp_mpj_id=?, stp_stg_id=?, stp_strategy=?, stp_goal=?
WHERE stp_id=?";
$this->db->query($sql, array($this->stp_mpj_id, $this->stp_stg_id, $this->stp_strategy, $this->stp_goal, $this->stp_id));
}
function delete() {
// if there is no primary key, please remove WHERE clause.
$sql = "DELETE FROM $this->sa_dbname.sa_strategic_project
WHERE stp_id=?";
$this->db->query($sql, array($this->stp_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_strategic_project
WHERE stp_id=?";
$query = $this->db->query($sql, array($this->stp_id));
if ( $withSetAttributeValue ) {
$this->row2attribute( $query->row() );
} else {
return $query ;
}
}
} //=== end class Da_sa_strategic_project
?>
|