Viewing file: da_sa_integration_course.php (1.5 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once("sa_model.php");
class Da_sa_integration_course extends Sa_model {
// PK is igc_id
public $igc_id;
public $igc_mjp_id;
public $igc_crs_id;
public $last_insert_id;
function Da_sa_integration_course() {
parent::__construct();
}
function insert() {
// if there is no auto_increment field, please remove it
$sql = "INSERT INTO sa_integration_course (igc_id, igc_mjp_id, igc_crs_id)
VALUES(?, ?, ?)";
$this->db->query($sql, array($this->igc_id, $this->igc_mjp_id, $this->igc_crs_id));
$this->last_insert_id = $this->db->insert_id();
}
function update() {
// if there is no primary key, please remove WHERE clause.
$sql = "UPDATE sa_integration_course
SET igc_mjp_id=?, igc_crs_id=?
WHERE igc_id=?";
$this->db->query($sql, array($this->igc_mjp_id, $this->igc_crs_id, $this->igc_id));
}
function delete() {
// if there is no primary key, please remove WHERE clause.
$sql = "DELETE FROM sa_integration_course
WHERE igc_id=?";
$this->db->query($sql, array($this->igc_id));
}
/*
* You have to assign primary key value before call this function.
*/
function get_by_key($withSetAttributeValue=FALSE) {
$sql = "SELECT *
FROM sa_integration_course
WHERE igc_id=?";
$query = $this->db->query($sql, array($this->igc_id));
if ( $withSetAttributeValue ) {
$this->row2attribute( $query->row() );
} else {
return $query ;
}
}
} //=== end class Da_sa_integration_course
?>
|