/** * @param Category $category * @return bool * this function will add a category to the database * it takes q category object */ function Add_Category(Category $category) { $category_name = $category->getCategoryName(); $category_name_amharic = $category->getCategoryNameAmharic(); $General_Category = $category->getGeneralCategory(); $query = "INSERT INTO category (Name,Name_Amharic,General_Category) VALUES ('{$category_name}','{$category_name_amharic}','{$General_Category}')"; $result = mysqli_query($this->getDbc(), $query); if ($result) { return TRUE; } else { return FALSE; } }
function Edit_Category(Category $Category, $Category_ID) { $Name = $Category->getCategoryName(); $Name_Amharic = $Category->getCategoryNameAmharic(); $General_Category = $Category->getGeneralCategory(); $query = "UPDATE Category set Name='{$Name}',Name_Amharic='{$Name_Amharic}',General_Category='{$General_Category}' where ID='{$Category_ID}'"; $result = mysqli_query($this->getDbc(), $query); //if the company is deleted return true if ($result) { return TRUE; } else { return FALSE; } }