I have to show member(model) except member with authentication === staff
I have 3 tables
accounts (id is the primary)
members(id is the primary, account_id is the foreignkey)
authassignment (itemname, user_id is foreignkey)
please check this picture
http://farm6.staticflickr.com/5483/11561320666_16f41c3e2c_b.jpg
I hope your tables has relations. I’m assuming you Accounts Model is with bellow relatins
class Accounts extends CActiveRecord
{
public function relations()
{
return array(
'authitemRelation' => array(self::HAS_MANY, 'Authitem', 'account_id'),
'membersRelation' => array(self::HAS_MANY, 'Members', 'account_id'),
);
}
........
........
}
In this case you can retrieve the details with with()
$criteria= new CDbCriteria();
$criteria->addCondition(array('where'=>'authitem.itemname not like "staff"'));
$data = yourAccountsModel::model()->with('authitemRelation','membersRelation')->findAll($criteria);
echo "<pre>";
print_r($data);
You may use relations to set the relationships between your tables. Read this. http://www.yiiframework.com/doc/guide/1.1/en/database.arr