You are here

function votingapi_get_voting_results in Voting API 5

A simple helper function that returns the cached voting results for a given piece of content.

Parameters

$content_type: A string identifying the type of content whose votes are being retrieved. Node, comment, aggregator item, etc.

$content_id: The key ID of the content whose votes are being retrieved.

Return value

An array of matching votingapi_cache records.

File

./votingapi.module, line 376

Code

function votingapi_get_voting_results($content_type, $content_id) {
  $voting_results = array();
  $result = db_query("SELECT * FROM {votingapi_cache} v WHERE content_type='%s' AND content_id=%d", $content_type, $content_id);
  while ($cached = db_fetch_object($result)) {
    $voting_results[] = $cached;
  }
  return $voting_results;
}