views:

82

answers:

2

I have

1.Table:user(userId,userName,userGroup)

2.Model:userModel

3.usercontroller

there i a simple code:

Controller:

class UserController extends Zend_Controller_Action
{    
    public function getuser()
    {
      $userModel = new userModel();
      $this->view->usergroup = $userModel;
    }
}

Model:

class Model_UserGroupModel extends Zend_Db_Table_Abstract {
  public function getuser(
   {
 $select = $this->select();
 return $this->fetchAll($select);
   }
}

view:

please tell me what code I must insert in view to only have user with specific row like user with group teacher also i use partialoop???

A: 
foreach ($this->usergroup->toArray() as $userGroup) {
         echo $userGroup['row'];
}

should work

ArneRie
A: 

To filter rows based on a particular field like userGroup you need to do a query with where condition.

    $where = $this->getAdapter->quoteInto("userGroup = ?", 'teacher');
    $select = $this->select()->where($where);

So now you can get users for a particular user group.

abhinavlal