Documentation

CChapter::Update

bool
CChapter::Update(
 int   ID,
 array arFields
);

The Update method modifies the parameters of the specified chapter.

Parameters

ParameterDescription
ID The chapter ID.
arFields The array Array("field"=>"value", ...). Contains values of all chapter fields. Required fields must be present.

Return Values

The method returns true on successful update, or false otherwise. If an error occurs, the exception will contain the error description.

See Also

  • Chapter fields
  • CChapter::Add

    Example

    
    <?
    if (CModule::IncludeModule("learning"))
    {
        $CHAPTER_ID = 299;
    
        $arFields = Array(
            "ACTIVE" => "N",
            "NAME" => "New name of Chapter 1",
            "SORT" => "555",
        );
    
        $chapter = new CChapter;
        $success = $chapter->Update($CHAPTER_ID, $arFields);
    
        if($success)
        {
            echo "Ok!";
        }
        else
        {
            if($e = $APPLICATION->GetException())
                echo "Error: ".$e->GetString();
        }
    
    }
    ?>
  • © «Bitrix24», 2001-2024
    Up