/** * Edits an item * * @param - int $id The id * @param - String $name The name * @param - String $description The description * @param - int $category The category-ID * @param - String $courseCode The course-Code (optional) */ function edit_item($id, $name, $description, $category, $course = "") { if (!Rsys::item_allow($id, 'edit')) { return false; } if (!Rsys::check_item($name, $category, $id)) { return false; } $sql = "UPDATE " . Rsys::getTable("item") . " SET category_id='" . Database::escape_string($category) . "',course_code='" . Database::escape_string($course) . "',name='" . Database::escape_string($name) . "',description='" . Database::escape_string($description) . "' " . "WHERE id =" . Database::escape_string($id) . ""; Database::query($sql); return $id; }