source: pro-violet-viettel/sourcecode/application/modules/frontend/models/servicepackage_model.php @ 501

Last change on this file since 501 was 501, checked in by dungnv, 11 years ago
File size: 1.4 KB
Line 
1<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
2
3class Servicepackage_model extends MY_Model
4{
5       
6        protected $table_name = 'tblservicepackage';
7        protected $id_name = 'p_id';
8        const TOKENPW = 'violet';
9       
10        function __construct()
11        {
12        parent::__construct();
13                $this->vservices->setApiUrl($this->config->item('api_url'));
14                $this->vservices->setConnection($this->curl);
15    }
16       
17    function getAllPackages()
18    {
19        $this->db->query('UNLOCK TABLES');
20        $sql="SELECT * FROM ".$this->table_name."";
21        return $this->db->query($sql)->result_array();
22    }
23   
24    function getPackage($p_id)
25    {
26        $this->db->query('UNLOCK TABLES');
27        $sql="SELECT * FROM ".$this->table_name." WHERE ".$this->id_name."=".$p_id;
28        return $this->db->query($sql)->row_array();
29    }
30   
31    function getPackagePriceByCode ($p_code)
32    {
33        $this->db->query('UNLOCK TABLES');
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    {
42        $this->db->query('UNLOCK TABLES');
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    }
48       
49}
Note: See TracBrowser for help on using the repository browser.