ich habe mir einen kleinen News Mod fürs phpbb gebastelt,die tabelle dafür ist wie folgt aufgebaut:
Code: Alles auswählen
news_id | news_typ | user_id | news_text
Code: Alles auswählen
$sql = "SELECT user_id, count(*) AS total
FROM " . NEWS_TABLE . "
WHERE news_type = 1 AND user_id = " . $userdata['user_id'];
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not get user id and username from users table', '', __LINE__, __FILE__, $sql);
}
if ( $total = $db->sql_fetchrow($result) )
{
$comment_news = $total['total'];
}
Code: Alles auswählen
$sql = "SELECT user_id, count(*) AS comment, count(n.*) AS uncomment
FROM " . NEWS_TABLE . "
LEFT JOIN " NEWS_TABLE . " n ON n.news_type = 2 AND user_id = '.$userdata['user_id'].'
WHERE news_type = 1 AND user_id = " . $userdata['user_id'];
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not get user id and username from users table', '', __LINE__, __FILE__, $sql);
}
if ( $comment = $db->sql_fetchrow($result) )
{
$comment = $comment['comment'];
}
if ( $uncomment = $db->sql_fetchrow($result) )
{
$uncomment = $uncomment['uncomment'];
}
Ich hoffe mal es hat jemand verstanden was ich meine und kann mir helfen

Grüße Jason