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