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