【发布时间】:2013-11-18 11:49:37
【问题描述】:
我有一个 mysql 查询,我在其中按发布日期对每个帖子进行分组。我希望能够回应每天发生的帖子数量,知道方法吗?
这是我到目前为止所写的内容,它确实会在发布的每一天发布一个新的<div>。
$trendQuery = "
SELECT DATE(timestamp) AS ForDate,
COUNT(*) AS NumPosts
FROM trends
WHERE `trend` = '" . $_GET['graph'] . "'
GROUP BY DATE(timestamp)
ORDER BY ForDate
";
$result = mysql_query($trendQuery);
while ($row = mysql_fetch_array($result)) {
echo'
<div>
<p>Here is where I want to say how many posts that happened!</p>
</div>
';
}
【问题讨论】:
-
echo $row['NumPosts'];不起作用吗?还是我错过了什么? -
记住不要使用已弃用的
mysql_*函数:stackoverflow.com/questions/12859942/…