Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有带有枚举('0','1')的数据库字段用户类型,默认为1 当使用带有条件值枚举的CActiveDataProvider()时,它会产生反向行。$dataProvider = new CActiveDataProvider('ClubMember',array('criteria'=>array('condition'=>'usertype=1', ), ));
这将产生除usertype=1 之外的所有行,即产生所有usertype=0 的行。
尝试使用这个
$dataProvider = new CActiveDataProvider('ClubMember', array( 'criteria'=> array( 'condition'=>'usertype = "1"' )));
这意味着您应该在 ENUM 中使用字符串作为值,而不是 int