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