AnswerTable::setCounter

  1. Bitrix24 API (v. 23.675.0)
  2. vote
  3. AnswerTable
  4. setCounter
  • Модуль: vote
  • Путь к файлу: ~/bitrix/modules/vote/lib/answer.php
  • Класс: BitrixVoteAnswerTable
  • Вызов: AnswerTable::setCounter
static function setCounter(array $id, $increment = true)
{
	$id = implode(", ", array_map('intval', $id));
	if (empty($id))
		return;
	$connection = BitrixMainApplication::getInstance()->getConnection();

	$sql = intval($increment);
	if ($increment === true)
		$sql = "COUNTER+1";
	else if ($increment === false)
		$sql = "COUNTER-1";
	$connection->queryExecute("UPDATE ".self::getTableName()." SET COUNTER=".$sql." WHERE ID IN (".$id.")");
}

Добавить комментарий