emlog获取文章评论数、未审核文章、已审核文章
0
741
2020年12月3日
直接上代码吧 下面代码扔到module.php
<?php
//评论
function comments_count(){
global $userData;
$DB = Database::getInstance();
$result=$DB->query('SELECT count(*) as "counts" FROM '.DB_PREFIX.'comment where mail="'.$userData['email'].'"');
$res = $DB->fetch_array($result);
return $res['counts'];
}
//未审核文章数
function count_no(){
global $userData;
$DB = Database::getInstance();
$result=$DB->query('SELECT COUNT(*) AS "total" FROM ' . DB_PREFIX . 'blog WHERE author="'.$userData['uid'].'" AND checked = "n" AND type = "blog"');
$res = $DB->fetch_array($result);
return $res['total'];
}
//已审核文章数
function count_yes(){
global $userData;
$DB = Database::getInstance();
$result=$DB->query('SELECT COUNT(*) AS "total" FROM ' . DB_PREFIX . 'blog WHERE author="'.$userData['uid'].'" AND checked = "y" AND type = "blog"');
$res = $DB->fetch_array($result);
return $res['total'];
}
?>
食用方法
下面的放到你想要显示的地方即可
<?php echo comments_count(); ?>
<?php echo count_no(); ?>
<?php echo count_yes(); ?>
这个主题简介啊