You are here

function _simpleads_campaigns_count_ad_impressions in SimpleAds 7

Helper function. Get number of unique impressions.

Parameters

int $timestamp:

int $nid:

2 calls to _simpleads_campaigns_count_ad_impressions()
_simpleads_campaigns_complete in modules/simpleads_campaigns/campaigns.helper.inc
Helper function. Deactivate ad if the ad riches campaings limits.
_simpleads_campaign_details in modules/simpleads_campaigns/campaigns.admin.inc
Menu callback. Campaign details.

File

modules/simpleads_campaigns/campaigns.helper.inc, line 158
SimpleAds helper functions.

Code

function _simpleads_campaigns_count_ad_impressions($timestamp, $nid) {
  $count = db_query("SELECT IFNULL(SUM(s.impressions_unique), 0) FROM {simpleads_stats} s\n    WHERE s.nid = :nid AND UNIX_TIMESTAMP(STR_TO_DATE(s.date, '%Y%m%d')) >= :timest", array(
    ':nid' => $nid,
    ':timest' => $timestamp,
  ))
    ->fetchField();
  return $count;
}