public function update(Category $category) { if ($this->find($category->getId())) { $catId = $category->getId(); $userId = $category->getUser()->getId(); $superCat = $category->getParentCategory()->getId(); $subCat = $category->getSubCategory(); $sql = "UPDATE " . $this->TABLE_NAME . " SET\n userId='{$userId}',superCategory='{$superCat}',subCategory='{$subCat}'\n WHERE id='{$catId}'"; if (mysql_query($sql, $this->connection)) { return true; } else { return false; } } else { return false; } }