Example #1
0
		public static function getByItem($id)
		{
			global $db;
			$itemSQL = "SELECT * FROM items WHERE itemid=?";
			$values = array($id);
			$item = $db->qwv($itemSQL, $values);
			
			$catSQL = "SELECT * FROM categories WHERE categoryid=?";
			$values = array($item[0]['categoryid']);
			$cat = $db->qwv($catSQL, $values);
			
			return Category::wrap($cat);
		}
Example #2
0
		public function getParent()
		{
			global $db;
			
			$nums = explode(".", $this->number);
			array_pop($nums);
			$number = implode(".", $nums);
			
			$sql = "SELECT * FROM categories WHERE number=?";
			$values = array( $number );
			$cat = $db->qwv($sql, $values);
			
			return Category::wrap($cat);
		}