我有这个
$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`)
) ;