<?php
$userCount  =   $db->prepare("SELECT `id` FROM users");
$userCount->execute();
$chatsCount  =   $db->prepare("SELECT `id` FROM chats");
$chatsCount->execute();
$messagesCount  =   $db->prepare("SELECT `id` FROM messages");
$messagesCount->execute();
?>

<div class="panel sky">
    <div class="panel-heading">
        <h3 class="panel-title"><i class="fa fa-asterisk"></i> Links</h3>
    </div>
    <div class="panel-body">
        <div class="list-group borderless" id="ct-admin-sidenav">
            <a class="list-group-item" href="index.php">
                <span class="badge green">Active</span>
                <i class="fa fa-cogs"></i> Settings
            </a>
            <a class="list-group-item" href="manage-users.php">
                <span class="badge blue"><?php echo $userCount->rowCount(); ?></span>
                <i class="fa fa-users"></i> Users
            </a>
            <a class="list-group-item" href="manage-chats.php">
                <span class="badge red"><?php echo $chatsCount->rowCount(); ?></span>
                <i class="fa fa-comments"></i> Chats
            </a>
            <a class="list-group-item" href="manage-messages.php">
                <span class="badge orange"><?php echo $messagesCount->rowCount(); ?></span>
                <i class="fa fa-tags"></i>  Messages
            </a>
        </div>
    </div>
</div>