I have a PHP function that looks like this:
function count_creatives() {
global $db;
$q = "SELECT COUNT(DISTINCT creative) FROM actions";
return $db->query($q);
}
The $db variable contains a PDO object and is set correctly (used successfully elsewhere).
When I try to assign the result of this function to a variable, it only contains the querystring (no results).
Code I'm Running:
$count = count_creatives();
echo $count;
Output:
PDOStatement Object ( [queryString] => SELECT COUNT(DISTINCT creative) FROM actions )
Any idea why I'm not getting the actual count (e.g. 2, 3, 100)?