Viewing file: da_ver_client_system.php (1.51 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once("ver_model.php");
class Da_ver_client_system extends Ver_model { // PK is csys_id public $csys_id; public $csys_en_name; public $csys_th_name;
public $last_insert_id;
function __construct() { parent::__construct(); } function insert() { // if there is no auto_increment field, please remove it $sql = "INSERT INTO ".$this->ver_db.".ver_client_system (csys_id, csys_en_name, csys_th_name) VALUES(?, ?, ?)"; $this->db->query($sql, array($this->csys_id, $this->csys_en_name, $this->csys_th_name)); $this->last_insert_id = $this->db->insert_id(); } function update() { // if there is no primary key, please remove WHERE clause. $sql = "UPDATE ".$this->ver_db.".ver_client_system SET csys_en_name=?, csys_th_name=? WHERE csys_id=?"; $this->db->query($sql, array($this->csys_en_name, $this->csys_th_name, $this->csys_id)); } function delete() { // if there is no primary key, please remove WHERE clause. $sql = "DELETE FROM ".$this->ver_db.".ver_client_system WHERE csys_id=?"; $this->db->query($sql, array($this->csys_id)); } /* * You have to assign primary key value before call this function. */ function get_by_key($withSetAttributeValue=FALSE) { $sql = "SELECT * FROM ".$this->ver_db.".ver_client_system WHERE csys_id=?"; $query = $this->db->query($sql, array($this->csys_id)); if ( $withSetAttributeValue ) { $this->row2attribute( $query->row() ); } else { return $query ; } } } //=== end class Da_ver_client_system ?>
|