I'm having trouble getting the count() function to output as 0. I'm not even sure if I'm going about it the right way. I'm trying to count the posts by users (which works), but I can't get it to give any output at all if there are no posts by a user. Could someone please tell me what I'm doing wrong? here is what I have so far:
$pcount = mysql_query("SELECT post_author, COUNT(post_author) FROM newsposts WHERE post_author = '$ID' GROUP BY post_author")
or die("Problem with the query");
while(list($user_ID, $post_count) = mysql_fetch_row($pcount))
//I can't get this bit to work 🙁
if ($post_count == "") {$number = (0);
}
//this bit seems fine though
else if($post_count > 0) {$number = $post_count;
}
{
echo "$number";
}