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

Last change on this file since 500 was 499, checked in by dungnv, 11 years ago
File size: 1.2 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        $sql="SELECT * FROM ".$this->table_name."";
20        return $this->db->query($sql)->result_array();
21    }
22   
23    function getPackage($p_id)
24    {
25        $sql="SELECT * FROM ".$this->table_name." WHERE ".$this->id_name."=".$p_id;
26        return $this->db->query($sql)->row_array();
27    }
28   
29    function getPackagePriceByCode ($p_code)
30    {
31        $sql='SELECT p_price FROM '. $this->table_name .' WHERE p_code = ?';
32        $query =  $this->db->query($sql , array($p_code));
33        $row = $query->row_array();
34        return $row['p_price'];
35    }
36   
37    function getPackageByCode ($p_code)
38    {
39        $sql='SELECT * FROM '. $this->table_name .' WHERE p_code = ?';
40        $query =  $this->db->query($sql , array($p_code));
41        $row = $query->row_array();
42        return $row;
43    }
44       
45}
Note: See TracBrowser for help on using the repository browser.