我有一个简单的数组,以前使用过,没有问题。现在我试图再次使用它并且它没有显示任何文本(即使在视图源中)。
大批:
$month = Array(
1 => "January",
2 => "February",
3 => "March",
4 => "April",
5 => "May",
6 => "June",
7 => "July",
8 => "August",
9 => "September",
10 => "October",
11 => "November",
12 => "December"
);
代码:
function getMonthlyStats($comic_id) {
require "config.php";
$query = 'SELECT *, SUM(views) AS `views` FROM '.$db_tbl_stats.' WHERE '.$db_fld_stats_comic_id.'="'.$comic_id.'" GROUP BY '.$db_fld_stats_month.' ASC';
$r_query = mysql_query($query);
while ($result = mysql_fetch_array($r_query)) {
$percent = ($result[$db_fld_stats_views]/getTotalStats($comic_id))*100;
$m = number_format($result['month']);
echo '<tr>';
echo '<td width="100"> ';
echo $month[$m];
echo '</td>';
echo '<td width="400" class="bar"><div style="width: '.$percent.'%"></div>'.$result[$db_fld_stats_views].' Views</td>';
echo '<td>'.number_format($percent).'%</td>';
echo '</tr>';
}
}
$m 返回一个 1-12 的数字,显然代表一个月。
如果您需要更多信息,我将很乐意解释更多。任何帮助是极大的赞赏!写了四个小时,眼睛都累了。