Documentation

CStudent::Add

int
CStudent::Add(
 array arFields
);

The Add method adds a new student account.

Parameters

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

Return Values

The method returns the ID of the added student account (which is the same as the user ID) on success, or false otherwise. If an error occurs, the exception will contain the error description.

See Also

  • CStudent::Update
  • Student account fields
  • Example

    
    <?
    if (CModule::IncludeModule("learning"))
    {
        $arFields = Array(
            "USER_ID" => 151,
            "RESUME" => "My resume"
        );
    
        $student = new CStudent;
        $ID = $student->Add($arFields);
        $success = ($ID>0);
    
        if($success)
        {
            echo "Ok!";
        }
        else
        {
            if($e = $APPLICATION->GetException())
                echo "Error: ".$e->GetString();
        }
    }
    ?>
    © «Bitrix24», 2001-2024
    Up