NoteOnMe博客平台搭建
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
495 B

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