NoteOnMe博客平台搭建
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

15 行
495 B

<?php
$stmt0 = $pdo->query("SELECT COUNT(*) AS count FROM article ");
$row0 = $stmt0->fetch();
$rowcount = $row0[0];
$stmt1 = $pdo->query("SELECT category,COUNT(*) AS count FROM article GROUP BY category");
while ( $row1 = $stmt1->fetch(PDO::FETCH_ASSOC) ) {
$width=5+$row1['count']/$rowcount*10;
$height=3+$row1['count']/$rowcount*6;
echo('<button type="button" style="height:'.$height.'em; width:'.$width.'em;">');
echo($row1['category']);
echo('</button>');
}
?>