Arrays in Plugins
-
Hi,
This is my first Plugin – and is embarrassingly basic, but we’ve all got to start somewhere! All it does is return how many unique/individual commentors comment on a blog.
Problem is, I can’t get the result from the array. I’m using MySQL to do the maths for me, into a var named thecount
function wl_comment_count() {
global $wpdb;$ccount = $wpdb->get_results("SELECT COUNT (DISTINCT comment_author_email) AS thecount FROM $wpdb->comments WHERE comment_approved = '1'");
if ($ccount) {$totalcount = $ccount['thecount'];
} else {
$totalcount=0;
}
echo $totalcount;
}The SQL is tried and tested – what am I doing wrong with the array?
Thanks
Will
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Arrays in Plugins’ is closed to new replies.