私はこれを持っています
$query = mysql_query("SELECT *, COUNT(*) FROM impressions WHERE pub_tag = '$pub_tag' AND pub_id = '$pub_id' AND month = '$date' GROUP BY country");
while($stat_cont = mysql_fetch_array($query)) {
echo '[\''.$stat_cont['country'].'\', '.$stat_cont['COUNT(*)'].'],';
}
何も表示されず、エラーも発生しません。WHEREを削除すると機能します。
CREATE TABLE IF NOT EXISTS `impressions` (
`id` int(15) unsigned NOT NULL AUTO_INCREMENT,
`pub_id` int(10) unsigned NOT NULL,
`pub_tag` varchar(10) NOT NULL,
`time` int(10) unsigned NOT NULL,
`month` int(6) unsigned NOT NULL,
`ip` int(15) unsigned NOT NULL,
`country` varchar(100) NOT NULL,
`country_city` varchar(150) NOT NULL,
`country_region` varchar(100) NOT NULL,
`country_code` varchar(2) NOT NULL,
`revenue` float unsigned NOT NULL,
PRIMARY KEY (`id`)
) ;