Viewing file: m_ver_upd_data.php (2.33 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once(dirname(__FILE__).'/da_ver_upd_data.php');
class M_ver_upd_data extends Da_ver_upd_data {
/* * aOrderBy = array('fieldname' => 'ASC|DESC', ... ) */ function get_all($aOrderBy=""){ $orderBy = ""; if ( is_array($aOrderBy) ) { $orderBy.= "ORDER BY "; foreach ($aOrderBy as $key => $value) { $orderBy.= "$key $value, "; } $orderBy = substr($orderBy, 0, strlen($orderBy)-2); } $sql = "SELECT * FROM ver_upd_data $orderBy"; $query = $this->db->query($sql); return $query; } /* * create array of pk field and value for generate select list in view, must edit PK_FIELD and FIELD_NAME manually * the first line of select list is '-----เลือก-----' by default. * if you do not need the first list of select list is '-----เลือก-----', please pass $optional parameter to other values. * you can delete this function if it not necessary. */ function get_options($optional='y') { $qry = $this->get_all(); if ($optional=='y') $opt[''] = '-----เลือก-----'; foreach ($qry->result() as $row) { $opt[$row->PK_FIELD] = $row->FIELD_NAME; } return $opt; } // add your functions here
function get_last_update($limit=0,$start=0,$nolimit=0) { $sql =" SELECT * FROM ".$this->ver_db.".ver_upd_data LEFT JOIN ".$this->ver_db.".ver_client_system ON csys_id = udt_tx_sys_id ORDER BY udt_tx_sys_id ASC,udt_tx_id ASC,udt_date DESC,udt_time DESC "; if(!$nolimit) { $sql .= " LIMIT ?,? "; $query = $this->db->query($sql,array($start,$limit)); } else { $query = $this->db->query($sql); } return $query; }
function get_non_update() { $sql = "SELECT * FROM ".$this->ver_db.".ver_upd_data LEFT JOIN ".$this->ver_db.".ver_client_system ON csys_id = udt_tx_sys_id WHERE udt_status = ? ORDER BY udt_tx_sys_id ASC,udt_tx_id ASC,udt_date DESC,udt_time DESC "; $query = $this->db->query($sql,array($this->udt_status)); return $query; }
function getByUpdId() { $sql = "SELECT * FROM ".$this->ver_db.".ver_upd_data WHERE udt_upd_id = ? "; $query = $this->db->query($sql,array($this->udt_upd_id)); return $query; }
function pcs_query($sql,$db='') { // $this->db = $this->load->database('ver',TRUE); if($db !='') $this->db->query('USE '.$db.';'); $this->db->query($sql); return; }
} // end class M_ver_upd_data ?>
|