You are here

function _simpleads_campaigns_count_ad_clicks in SimpleAds 7

Helper function. Get number of unique clicks.

Parameters

int $timestamp:

int $nid:

2 calls to _simpleads_campaigns_count_ad_clicks()
_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 172
SimpleAds helper functions.

Code

function _simpleads_campaigns_count_ad_clicks($timestamp, $nid) {
  $count = db_query("SELECT IFNULL(SUM(s.clicks_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;
}