a4d7e2d463b7d67966621d59cd4d4b31a19bcc3b
[fa-stable.git] / gl / includes / db / gl_db_currencies.inc
1 <?php
2
3 //---------------------------------------------------------------------------------------------
4
5 function update_currency($curr_abrev, $symbol, $currency, $country, $hundreds_name)
6 {
7         $sql = "UPDATE ".TB_PREF."currencies SET currency=".db_escape($currency).", curr_symbol='$symbol',
8                 country=".db_escape($country).", hundreds_name=".db_escape($hundreds_name)." WHERE curr_abrev = '$curr_abrev'";
9
10         db_query($sql, "could not update currency for $curr_abrev");
11 }
12
13 //---------------------------------------------------------------------------------------------
14
15 function add_currency($curr_abrev, $symbol, $currency, $country, $hundreds_name)
16 {
17         $sql = "INSERT INTO ".TB_PREF."currencies (curr_abrev, curr_symbol, currency, country, hundreds_name)
18                 VALUES (".db_escape($curr_abrev).", '$symbol', ".db_escape($currency).", ".db_escape($country).", ".db_escape($hundreds_name).")";
19
20         db_query($sql, "could not add currency for $curr_abrev");
21 }
22
23 //---------------------------------------------------------------------------------------------
24
25 function delete_currency($curr_code)
26 {
27         $sql="DELETE FROM ".TB_PREF."currencies WHERE curr_abrev='$curr_code'";
28         db_query($sql, "could not delete currency       $curr_code");
29
30         $sql="DELETE FROM ".TB_PREF."exchange_rates WHERE curr_code='$curr_code'";
31         db_query($sql, "could not delete exchange rates for currency $curr_code");
32 }
33
34 //---------------------------------------------------------------------------------------------
35
36 function get_currency($curr_code)
37 {
38         $sql = "SELECT * FROM ".TB_PREF."currencies WHERE curr_abrev='$curr_code'";
39         $result = db_query($sql, "could not get currency $curr_code");
40
41         $row = db_fetch($result);
42         return $row;
43 }
44
45 //---------------------------------------------------------------------------------------------
46
47 function get_currencies()
48 {
49         $sql = "SELECT * FROM ".TB_PREF."currencies";
50         return db_query($sql, "could not get currencies");
51 }
52
53 //---------------------------------------------------------------------------------------------
54
55 ?>