*** empty log message ***
[fa-stable.git] / inventory / includes / db / items_category_db.inc
1 <?php
2
3 function add_item_category($description)
4
5 {
6         $sql = "INSERT INTO ".TB_PREF."stock_category (description) 
7                 VALUES ('$description')";
8    
9         db_query($sql,"an item category could not be added");
10 }
11
12 function update_item_category($ItemCategory, $description)
13
14 {
15         $sql = "UPDATE ".TB_PREF."stock_category SET description = '$description' 
16         WHERE category_id = '$ItemCategory'";   
17         
18         db_query($sql,"an item category could not be updated"); 
19 }
20
21 function delete_item_category($ItemCategory)
22 {
23         $sql="DELETE FROM ".TB_PREF."stock_category WHERE category_id='$ItemCategory'"; 
24         
25         db_query($sql,"an item category could not be deleted"); 
26 }
27
28 function get_item_category($ItemCategory)
29 {
30         $sql="SELECT * FROM ".TB_PREF."stock_category WHERE category_id='$ItemCategory'";       
31         
32         $result = db_query($sql,"an item category could not be retrieved");
33         
34         return db_fetch($result);       
35 }
36
37 function get_category_name($id)
38 {
39         $sql = "SELECT description FROM ".TB_PREF."stock_category WHERE category_id=$id";
40         
41         $result = db_query($sql, "could not get sales type");
42         
43         $row = db_fetch_row($result);
44         return $row[0];
45 }
46
47
48 ?>