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