Bitrix Site Manager

CLAnswer::Update

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

The Update method modifies the parameters of an answer identified by the ID.

Parameters

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

  • Answer fields
  • CLAnswer::Add

    Example

    
    <?
    if (CModule::IncludeModule("learning"))
    {
        $ANSWER_ID = 1553;
    
        $arFields = Array(
            "ANSWER" => "New answer name",
            "SORT" => "1",
        );
    
        $answer = new CLAnswer;
        $success = $answer->Update($ANSWER_ID, $arFields);
    
        if($success)
        {
            echo "Ok!";
        }
        else
        {
            if($e = $APPLICATION->GetException())
                echo "Error: ".$e->GetString();
        }
    }
    ?>