Viewing file: da_sa_adviser_project.php (1.58 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once("sa_model.php");
class Da_sa_adviser_project extends Sa_model {
// PK is adj_id
public $adj_id;
public $adj_mpj_id;
public $adj_prs_id;
public $last_insert_id;
function Da_sa_adviser_project() {
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_adviser_project (adj_id, adj_mpj_id, adj_prs_id)
VALUES(?, ?, ?)";
$this->db->query($sql, array($this->adj_id, $this->adj_mpj_id, $this->adj_prs_id));
$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_adviser_project
SET adj_mpj_id=?, adj_prs_id=?
WHERE adj_id=?";
$this->db->query($sql, array($this->adj_mpj_id, $this->adj_prs_id, $this->adj_id));
}
function delete() {
// if there is no primary key, please remove WHERE clause.
$sql = "DELETE FROM $this->sa_dbname.sa_adviser_project
WHERE adj_id=?";
$this->db->query($sql, array($this->adj_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_adviser_project
WHERE adj_id=?";
$query = $this->db->query($sql, array($this->adj_id));
if ( $withSetAttributeValue ) {
$this->row2attribute( $query->row() );
} else {
return $query ;
}
}
} //=== end class Da_sa_adviser_project
?>
|