我正在尝试向函数添加第二个查询。如何结合这两个查询?我想从表中删除一个用户并将另一个用户的状态从“等待列表”更改为“普通用户”。如果我分别检查它们,这两个查询都有效。
function delreguser()
{
$user = & JFactory::getUser();
$event = (int) $this->_id;
$userid = $user->get('id');
// Must be logged in
if ($userid < 1) {
JError::raiseError( 403, JText::_('ALERTNOTAUTH') );
return;
}
// update waitinglist
$query ='UPDATE #__eventlist_register SET uwl = 0 where event = '.$event.' AND uwl = 1 ORDER BY uregdate LIMIT 1';
// delete user
$query2 = 'DELETE FROM #__eventlist_register WHERE event = '.$event.' AND uid= '.$userid.'';
$this->_db->SetQuery( $query);
$this->_db->SetQuery( $query2);
if (!$this->_db->query()) {
JError::raiseError( 500, $this->_db->getErrorMsg() );
}
return true;
}