@openside("Ostatnie komentarze");
$result = dbquery(
"(SELECT comment_id, comment_message, comment_item_id, comment_datestamp, comment_type, ifnull(user_name, comment_name)as 'user_name' FROM ".$db_prefix."comments LEFT JOIN ".$db_prefix."users ON comment_name=user_id WHERE comment_type='N' GROUP BY comment_id, comment_message, comment_item_id, comment_datestamp, user_name ORDER BY comment_id DESC LIMIT 0,5)
UNION
(SELECT comment_id, comment_message, comment_item_id, comment_datestamp, comment_type, ifnull(user_name, comment_name)as 'user_name' FROM ".$db_prefix."comments LEFT JOIN ".$db_prefix."users ON comment_name=user_id WHERE comment_type='A' GROUP BY comment_id, comment_message, comment_item_id, comment_datestamp, user_name ORDER BY comment_id DESC LIMIT 0,5)"
);
if (dbrows($result) != 0) {
while($data = dbarray($result)) {
$itemsubject = trimlink($data['comment_message'], 50);
switch ($data['comment_type']) {
case 'A': $typ='readarticle.php?article_id';
$nazwa='';
break;
case 'A':$typ='index.php?readmore' ;
$nazwa='';
break;
default:
}
echo "".$nazwa." ".$data['user_name']."".showdate("shortdate", $data['comment_datestamp'])." ".parseubb(parsesmileys($itemsubject))."
\n";
}
} else {
echo "