- Code: Select all
function stats() {
global $sql;
$stat = array('Users' => 'users', 'News' => 'news', 'Comments' => 'comments', 'Categories' => 'categories');
foreach ($stat as $name => $table) {
echo $name.": ".count($sql->select(array('table' => $table)))."<br>";
}
}
Then you can show the stats by calling the function: stats();
It will show you something like this:
Users: 1
News: 8
Comments: 4
Categories: 2
