I have this code to find a user from db which status is active and role is user
public static function findByUsername($username)
{
return static::find([\'userna
You can try:
public static function findByUsername($username)
{
$criteria = new CDbCriteria;
$criteria->addCondition("username != 'username'");
$criteria->addCondition("role != 'user'");
$result = User::model()->find($criteria);
return $result;
}
Or:
public static function findByUsername($username)
{
$result=Users::model()->findByAttributes(array('condition'=>"role != 'user',username = '$username'"));
}