Hi, I have the following code:
$users = Users::model()->find('LOWER(EMAIL)=?',array(strtolower($this->EMAIL)));
if($users === null)
$this->errorCode=self::ERROR_USERNAME_INVALID;
else if(($this->PASSWORD)!==$users->PASSWORD)
$this->errorCode=self::ERROR_PASSWORD_INVALID;
else
{
$this->_ID=$users->USER_ID;
$this->EMAIL=$users->EMAIL;
$this->setState("USER_ID", $this->_ID);
$this->setState("EMAIL", $this->EMAIL);
$this->setState("IS_VIP", 0 or 1 - > this should be a variable with the result from the comparision);
$this->errorCode=self::ERROR_NONE;
}
return !$this->errorCode;
$users->VIP_UNTIL should be a field from the database. The problem is how to compare NOW() and VIP_UNTIL. I can't use the IF/SWITCH approach as I am extracting data. Moreover, I am extracting data, so I suppose, I can't use the CDbExpression. Actually, the task is to understand whether VIP_UNTIL > NOW() and set the VIP state property to 1. Otherwise, to assign 0 to it.