<?php

require_once 'DatabaseConnector.php';

class Categories extends DatabaseConnector
{

   /**
    * Pobierz kategorie
    * @access remote
    * @returns tablica kategorii
    */
   function getCategories()
   {
      $rows = array();

      $link = $this->getConnection();

      $query = "SELECT id, name FROM categories WHERE active=1";

      $result = mysql_query($query, $link);

      if (mysql_num_rows($result) == 0)
      {
         trigger_error("No categories found");
         return false;
      }

      while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
      {
         array_push($rows, $row);
      }

      return $rows;
   }

   private function deleteCategory($cid)
   {
      $cid;
      // delete routine here
   }

}

?>
