-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcurrency_model.php
91 lines (79 loc) · 1.91 KB
/
currency_model.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
class currency_model extends CI_Model
{
function __construct()
{
parent::__construct();
$this->load->database("default");
}
/////// ----------------------- brands ----------------------------- ////////
function getBrands($curr_id = "",$select = "",$order = "")
{
//echo "pipo";
$where = "";
if($curr_id)
{
$where = " AND currency.curr_id = '".$curr_id."'";
}
if(is_array($curr_id))
{
$where = " AND currency.curr_id IN ('".implode("','",$curr_id)."')";
}
if($select == "")
{
$select = "currency.*";
}
$sql = "SELECT ".$select."
FROM ".DBPREFIX."_currency as currency";
$sql .= " ORDER BY ".$order."curr_id ASC";
// echo $sql;die;
$result = $this->db->query($sql);
if($result && $result->num_rows()>0)
{
return $result->result_array();
}
}
function insertbrands($data)
{
if(!(isset($data[0])))$data[0] = $data;
$this->db->insert_batch(DBPREFIX."_currency", $data);
return TRUE;
}
function deletebrands($curr_id)
{
$arr = array('curr_id' => $curr_id);
$this->db->where($arr);
$this->db->delete(DBPREFIX."_currency", $arr);
// echo "update".$brand_id;print_r($data);die;
return TRUE;
}
function updatebrands($curr_id,$data)
{
if(!(isset($data[0])))$data[0] = $data;
$arr = array('curr_id' => $curr_id);
$this->db->where($arr);
$this->db->update(DBPREFIX."_currency", $data[0]);
// echo "update".$brand_id;print_r($data);die;
return TRUE;
}
public function getBrandsByID($curr_id)
{
$sql = "SELECT * FROM ".DBPREFIX."_currency
WHERE curr_id = '".$curr_id."'
";
$result = $this->db->query($sql);
if($result && $result->num_rows()>0)
{
return $result->result_array();
}
}
public function getallcurrency()
{
$this->db->select("*");
$this->db->from("_currency");
$query = $this->db->get();
$result = $query->result_array();
return $result;
}
}
?>