title: Zend session and zend auth
body: <p>I have made a login system through zend auth here is the code</p>
  
  <pre><code>// userAuthentication
     public function authAction(){
         $request     = $this-&gt;getRequest();
         $registry    = Zend_Registry::getInstance();
         $auth        = Zend_Auth::getInstance(); 
         $DB = $registry['DB'];
             $authAdapter = new Zend_Auth_Adapter_DbTable($DB);
                 $authAdapter-&gt;setTableName('user')
                              -&gt;setIdentityColumn('user_name')
                              -&gt;setCredentialColumn('user_password');
  
        $username = $request-&gt;getParam('username');
        $password = $request-&gt;getParam('password');
        $authAdapter-&gt;setIdentity($username);
        $authAdapter-&gt;setCredential($password);
        $result = $auth-&gt;authenticate($authAdapter);
  
        if($result-&gt;isValid()){
             $data = $authAdapter-&gt;getResultRowObject(null,'password');
             $auth-&gt;getStorage()-&gt;write($data);
             $this-&gt;_redirect('/login/controlpannel');
         }else{
             $this-&gt;_redirect('/login/login');
          }
    }
  </code></pre>
  
  <p>This work fine now. There is user_id (column) in user (table) where there are username and password too. I need to get that specific user_id from this table which just login and put it in session through</p>
  
  <pre><code>$user_session = new Zend_Session_Namespace('user_session');
  $user_session-&gt;username = $username;
  $user_id-&gt;user_id       = $user_id;
  </code></pre>
  
  <p>so that I can query some info against this $user_id and pass the result into view (name) controlpanel</p>