2013-02-18 47 views
0

我收到以下錯誤「Error500:JTableUser ::綁定(NULL)」,當嘗試從字段集通過點擊值發送到數據庫提交按鈕。的Joomla JTable的錯誤

我保存功能模型是這樣的:

public function save($data) 
    { 
     $userId = (!empty($data['id'])) ? $data['id'] : (int) $this->getState('user.id'); 

     $user = new JUser($userId); 

     JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'tables'); 
     $table =& JTable::getInstance('User', 'JTable', array()); 

     // Unset the username so it does not get overwritten 
     unset($data['username']); 

     // Unset the block so it does not get overwritten 
     unset($data['block']); 

     // Unset the sendEmail so it does not get overwritten 
     unset($data['sendEmail']); 

     // Bind the data. 
     if (!$table->bind($data)) { 
      $this->setError(JText::sprintf('USERS PROFILE BIND FAILED', $user->getError())); 
      return false; 
     } 

     // Load the users plugin group. 
     JPluginHelper::importPlugin('user'); 

     // Null the user groups so they don't get overwritten 
     $user->groups = null; 

     // Store the data. 
     if (!$table->save()) { 
      $this->setError($user->getError()); 
      return false; 
     } 

     return $user->id; 
    }` 

$數據填寫正確,"getInstance('User', 'JTable', array());"工作好。 感謝您的關注,有誰能幫我解決我的麻煩?

回答