本文整理汇总了PHP中JTable::getError方法的典型用法代码示例。如果您正苦于以下问题:PHP JTable::getError方法的具体用法?PHP JTable::getError怎么用?PHP JTable::getError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JTable
的用法示例。
在下文中一共展示了JTable::getError方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postItem
/**
* Post single data record.
*
* Given a base query this method will return the single
* data record with the given value of a unique key.
*
* @param JDatabaseQuery $query A database query object.
* @param JTable $table The table to insert the data
* @param array $data The assoc array data
*
* @return mixed Exception if fail, true if ok.
*/
public function postItem(JDatabaseQuery $query, $table, $data)
{
// Bind data to save content
if (!$table->bind($data)) {
throw new Exception($table->getError());
}
// Check the content
//if (!$table->check()) {
// throw new Exception($table->getError());
//}
// Insert the content
if (!$table->store()) {
throw new Exception($table->getError());
}
return true;
}
示例2: save
function save()
{
JRequest::checkToken() or jexit('Invalid Token');
$record = JTable::getInstance('Status', 'Table');
$post = JRequest::get('POST');
$post['id'] = $post['id'] != 0 ? $post['id'] : false;
if (!$record->save($post)) {
// uh oh failed to save
JError::raiseError('500', JTable::getError());
}
$this->setRedirect('index.php?option=com_jobboard&view=statuses&task=save', JText::_('COM_JOBBOARD_STATUS_SAVED'));
}
示例3: apply
function apply()
{
JRequest::checkToken() or jexit('Invalid Token');
$applicant = JRequest::get('POST');
jimport('joomla.utilities.date');
$now = new JDate();
if ($applicant['job_id'] != 0) {
$unsol_id = $applicant['id'];
$applicant['id'] = false;
$applicant['request_date'] = $now->toMySQL();
$record =& JTable::getInstance('Applicant', 'Table');
if (!$record->save($applicant)) {
// uh oh failed to save
JError::raiseError('500', JTable::getError());
}
$unsol =& JTable::getInstance('Unsolicited', 'Table');
if (!$unsol->delete($unsol_id)) {
// uh oh failed to delete
JError::raiseError('500', JTable::getError());
}
$this->extendApply($applicant);
} else {
$applicant['last_updated'] = $now->toMySQL();
$unsol_record =& JTable::getInstance('Unsolicited', 'Table');
if (!$unsol_record->save($applicant)) {
// uh oh failed to save
JError::raiseError('500', JTable::getError());
}
$this->extendApply($applicant);
}
}