Advertisement
eimkasp

PHP Group BY

Mar 4th, 2012
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1. <html>
  2.     <head>
  3.     <title>OSTAPENKO FAN CLUB</title>
  4.     </head>
  5.     <body>
  6. <?php
  7.    
  8.    
  9.     $db =mysql_connect("localhost","PP30577C","PP30577C") or die ("cant connect");
  10.    
  11.     mysql_select_db("PP30577C",$db) or die("unable to find database");
  12.    
  13.     //$duom = mysql_query("SELECT COUNT(post_type) GROUP BY(post_type)");
  14.     $miestai = mysql_query("SELECT post_type, COUNT(post_type) from wp_posts GROUP BY(post_type)");
  15.    
  16.    
  17.     echo '<table border="1">';
  18.     while($result = mysql_fetch_array ($miestai)){
  19.         echo '<tr>';
  20.         echo '<td>' . $result[0] . '</td>';
  21.         echo '<td>' . $result[1] . '</td>';
  22.         echo '</tr>';
  23.     }
  24.     echo '</table>';
  25.     mysql_free_result($miestai);
  26.     ?>
  27.     </body>
  28. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement