Documentation

GetByID

CDBResult
CSubscription::GetByID(
    int ID
);

Method selects a subscription by its ID. Static method.

Parameters

ParameterDescriptionAvailable from version
ID Subscription ID.

Returned value

Returns a CDBResult result. Upon fetching from result by CDBResult class methods, "Subscription" object fields become available.

Example

//new or existing subscription?
//ID==0 indicates new subscription
if(strlen($sf_EMAIL) > 0 || $ID > 0)
{
    if($ID > 0)
        $subscription = CSubscription::GetByID($ID);
    else
        $subscription = CSubscription::GetByEmail($sf_EMAIL);

    if($subscription->ExtractFields("str_"))
        $ID = (integer)$str_ID;
    else
        $ID=0;
}
else
    $ID = 0;


© «Bitrix24», 2001-2024