You are here

function flag_flag::_increase_count in Flag 6.2

Same name and namespace in other branches
  1. 7.3 includes/flag/flag_flag.inc \flag_flag::_increase_count()
  2. 7.2 flag.inc \flag_flag::_increase_count()

Increases the flag count for a piece of content.

@private

Parameters

$content_id: For which item should the count be increased.

$number: The amount of counts to increasing. Defaults to 1.

1 call to flag_flag::_increase_count()
flag_flag::_flag in ./flag.inc
A low-level method to flag content.

File

./flag.inc, line 802
Implements various flags. Uses object oriented style inspired by that of Views 2.

Class

flag_flag
This abstract class represents a flag, or, in Views 2 terminology, "a handler".

Code

function _increase_count($content_id, $number = 1) {
  $time = time();
  db_query("UPDATE {flag_counts} SET count = count + %d, last_updated = %d WHERE fid = %d AND content_id = %d", $number, $time, $this->fid, $content_id);
  if (!db_affected_rows()) {
    db_query("INSERT INTO {flag_counts} (fid, content_type, content_id, count, last_updated) VALUES (%d, '%s', %d, %d, %d)", $this->fid, $this->content_type, $content_id, $number, $time);
  }
}