Location: PHPKode > projects > WH Community > wh_community/functions/statistic.php
<?php

    function stat_posts() {
        $abfrage = mysql_query("SELECT post_id FROM posts") OR die(mysql_error());
        $total = mysql_num_rows($abfrage);
        echo '<strong>' . (int)$total . '</strong>';
        }
    
    function stat_topics() {
        $abfrage = mysql_query("SELECT topic_id FROM topics") OR die(mysql_error());
        $total = mysql_num_rows($abfrage);
        echo '<strong>' . (int)$total . '</strong>';
        }
    
    function stat_categories() {
        $abfrage = mysql_query("SELECT cat_id FROM categories") OR die(mysql_error());
        $total = mysql_num_rows($abfrage);
        echo '<strong>' . (int)$total . '</strong>';
        }
    
    function stat_user() {
        $abfrage = mysql_query("SELECT user_id FROM users") OR die(mysql_error());
        $total = mysql_num_rows($abfrage);
        echo '<strong>' . (int)$total . '</strong>';
        }
    
    function stat_news() {
        $abfrage = mysql_query("SELECT id FROM news") OR die(mysql_error());
        $total = mysql_num_rows($abfrage);
        echo '<strong>' . (int)$total . '</strong>';
        }
    
    function stat_blog() {
        $abfrage = mysql_query("SELECT blog_id FROM blog") OR die(mysql_error());
        $total = mysql_num_rows($abfrage);
        echo '<strong>' . (int)$total . '</strong>';
        }
    
    function stat_com() {
        $abfrage = mysql_query("SELECT blog_id FROM comments") OR die(mysql_error());
        $total = mysql_num_rows($abfrage);
        echo '<strong>' . (int)$total . '</strong>';
        }
    
    function stat_today() {
        $table = 'counter';
        $sql_heute = "SELECT * FROM " . $table . "";
        $erg_heute = mysql_query($sql_heute) OR die(mysql_error());
        $heute = mysql_num_rows($erg_heute);
        echo '<strong>' . (int)$heute . '</strong>';
        }
    
    function stat_total() {
        $table = 'counter';
        $sql_gesamt = "SELECT * FROM " . $table . " ORDER BY id DESC";
        $erg_gesamt = mysql_query($sql_gesamt) OR die(mysql_error());
        $row = mysql_fetch_array($erg_gesamt);
        $gesamt = $row['id'];
        echo '<strong>' . (int)$gesamt . '</strong>';
        }
    
    function stat_online() {
        $table = 'counter';
        $zeit = "900";
        $time = time();
        $zeit = $time-$zeit;
        $sql_online = "SELECT * FROM " . $table . " WHERE timed > '" . $zeit . "'";
        $erg_online = mysql_query($sql_online) OR die(mysql_error());
        $online = mysql_num_rows($erg_online);
        echo '<strong>' . (int)$online . '</strong>';
        }

?>
Return current item: WH Community