$query = "SELECT count(*) FROM TABLE_NAME WHERE ID_USER='$USER_ID'"; $result = mysql_query($query); $query_data = mysql_fetch_row($result); $total_posts = $query_data[0]; echo $USER_ID . ' posted ' . $total_posts . ' news articles';