[490] | 1 | <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
---|
| 2 | |
---|
| 3 | class Servicepackage_model extends MY_Model |
---|
| 4 | { |
---|
| 5 | |
---|
| 6 | protected $table_name = 'tblservicepackage'; |
---|
| 7 | protected $id_name = 'p_id'; |
---|
| 8 | const TOKENPW = 'violet'; |
---|
| 9 | |
---|
[499] | 10 | function __construct() |
---|
| 11 | { |
---|
[490] | 12 | parent::__construct(); |
---|
| 13 | $this->vservices->setApiUrl($this->config->item('api_url')); |
---|
| 14 | $this->vservices->setConnection($this->curl); |
---|
| 15 | } |
---|
| 16 | |
---|
| 17 | function getAllPackages() |
---|
| 18 | { |
---|
[501] | 19 | $this->db->query('UNLOCK TABLES'); |
---|
[490] | 20 | $sql="SELECT * FROM ".$this->table_name.""; |
---|
| 21 | return $this->db->query($sql)->result_array(); |
---|
| 22 | } |
---|
[499] | 23 | |
---|
[490] | 24 | function getPackage($p_id) |
---|
| 25 | { |
---|
[501] | 26 | $this->db->query('UNLOCK TABLES'); |
---|
[490] | 27 | $sql="SELECT * FROM ".$this->table_name." WHERE ".$this->id_name."=".$p_id; |
---|
| 28 | return $this->db->query($sql)->row_array(); |
---|
| 29 | } |
---|
[499] | 30 | |
---|
| 31 | function getPackagePriceByCode ($p_code) |
---|
| 32 | { |
---|
[501] | 33 | $this->db->query('UNLOCK TABLES'); |
---|
[499] | 34 | $sql='SELECT p_price FROM '. $this->table_name .' WHERE p_code = ?'; |
---|
| 35 | $query = $this->db->query($sql , array($p_code)); |
---|
| 36 | $row = $query->row_array(); |
---|
| 37 | return $row['p_price']; |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | function getPackageByCode ($p_code) |
---|
| 41 | { |
---|
[501] | 42 | $this->db->query('UNLOCK TABLES'); |
---|
[499] | 43 | $sql='SELECT * FROM '. $this->table_name .' WHERE p_code = ?'; |
---|
| 44 | $query = $this->db->query($sql , array($p_code)); |
---|
| 45 | $row = $query->row_array(); |
---|
| 46 | return $row; |
---|
| 47 | } |
---|
[490] | 48 | |
---|
| 49 | } |
---|