|
|
- <?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>');
-
- }
- ?>
|