Viewing file: da_umusergroup.php (1.51 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
class Da_umusergroup extends CI_Model {
// PK is UgGpID, UgUsID
public $UgID;
public $UgGpID;
public $UgUsID;
public $last_insert_id;
function Da_umusergroup() {
parent::__construct();
$this->db = $this->load->database('alumniums', TRUE);
}
function insert() {
// if there is no auto_increment field, please remove it
$sql = "INSERT INTO ".$this->config->item('alumni_ums_dbname').".umusergroup (UgID, UgGpID, UgUsID)
VALUES(?, ?, ?)";
$this->db->query($sql, array($this->UgID, $this->UgGpID, $this->UgUsID));
$this->last_insert_id = $this->db->insert_id();
}
function update() {
// if there is no primary key, please remove WHERE clause.
$sql = "UPDATE umusergroup
SET UgID=?
WHERE UgGpID=? AND UgUsID=?";
$this->db->query($sql, array($this->UgID, $this->UgGpID, $this->UgUsID));
}
function delete() {
// if there is no primary key, please remove WHERE clause.
$sql = "DELETE FROM umusergroup
WHERE UgGpID=? AND UgUsID=?";
$this->db->query($sql, array($this->UgGpID, $this->UgUsID));
}
/*
* You have to assign primary key value before call this function.
*/
function get_by_key($withSetAttributeValue=FALSE) {
$sql = "SELECT *
FROM umusergroup
WHERE UgGpID=?, UgUsID=?";
$query = $this->db->query($sql, array($this->UgGpID, $this->UgUsID));
if ( $withSetAttributeValue ) {
$this->row2attribute( $query->row() );
} else {
return $query ;
}
}
} //=== end class Da_umusergroup
?>
|