Documentation

CLQuestion::Update

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

The Update method modifies the parameters of a question identified by the ID.

Parameters

ParameterDescription
ID The question ID.
arFields An array in the format Array("field"=>"value", ...). The array contains values of all question 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

  • Question fields
  • CLQuestion::Add

    Example

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