Viewing file: da_MapProgram.php (1.73 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once("my_ea_model.php");
class Da_mapprogram extends My_ea_model {
// PK is mapId
public $mapId;
public $mpGraduateY;
public $programId_reg;
public $programId_alumni;
public $last_insert_id;
function Da_mapprogram() {
parent::__construct();
$this->load->database('ea', TRUE);
}
function insert() {
// if there is no auto_increment field, please remove it
$sql = "INSERT INTO $this->ea_dbname.MapProgram (mapId, mpGraduateY, programId_reg, programId_alumni)
VALUES(?, ?, ?, ?)";
$this->db->query($sql, array($this->mapId, $this->mpGraduateY, $this->programId_reg, $this->programId_alumni));
$this->last_insert_id = $this->db->insert_id();
}
function update() {
// if there is no primary key, please remove WHERE clause.
$sql = "UPDATE $this->ea_dbname.MapProgram
SET mpGraduateY=?, programId_reg=?, programId_alumni=?
WHERE mapId=?";
$this->db->query($sql, array($this->mpGraduateY, $this->programId_reg, $this->programId_alumni, $this->mapId));
}
function delete() {
// if there is no primary key, please remove WHERE clause.
$sql = "DELETE FROM $this->ea_dbname.MapProgram
WHERE mapId=?";
$this->db->query($sql, array($this->mapId));
}
/*
* You have to assign primary key value before call this function.
*/
function get_by_key($withSetAttributeValue=FALSE) {
$sql = "SELECT *
FROM $this->ea_dbname.MapProgram
WHERE mapId=?";
$query = $this->db->query($sql, array($this->mapId));
if ( $withSetAttributeValue ) {
$this->row2attribute( $query->row() );
} else {
return $query ;
}
}
function last_insert_id(){
return $this->db->insert_id();
}
} //=== end class Da_mapprogram
?>
|