0
我想通過調用Zend_Auth
來獲取登錄用戶的用戶名,以限制下拉菜單中的1個選項。代碼看起來很好,但它只在下拉菜單中顯示1個空格。下拉菜單不起作用
$auth= Zend_Auth::getInstance();
$user= $auth->getIdentity();
$username = $user->username;
$memberid = $this->createElement('select', 'memberid'); //dropdown menu of member name
$memberid->setLabel('Member Id')
->setRequired(true);
$db_member = new Application_Model_DbTable_Register();
$select = $db_member->select('userid')
->from(array('usertable'))
->where('usertable.username = ?', $username);
$row = $db_member->fetchRow($select);
$memberid->addMultiOption($row['userid']);
注意到謝謝。然而,下拉框現在顯示'1'而不是'30'的用戶標識,它應該是我用戶的正確標識。 – 2012-08-08 16:21:02
沒關係,搞定了。 $ select = $ db_member-> select()<<引起了問題 無論如何感謝:) – 2012-08-08 16:24:30