Все можно, примерно следующим образом
<?
$room = mysql_query(\"SELECT inroom .* FROM `chat_room` AS c LEFT JOIN inroom ON(inroom.id_room = c.id) WHERE id IN(SELECT id_room FROM inroom WHERE time + \'300\' > \'\" . time() . \"\'\"
AS count ORDER BY `time` DESC, `title` DESC\"
;
while($chat = mysql_fetch_assoc($room))
{
echo \'<div class=\"body\"><img src=\"../images/guest.png\"> <b><a href=\"../chat/room.php?id=\'.$chat[\'id\'].\'\">\'.$chat[\'title\'].\'</a></b></div> Онлайн (<a href=\"room.php?act=inroom&id=\'.$chat[\'id\'].\'\"><b>\'.$chat[\'count\'].\'</b></a> чел<br>\';
if ($chat[\'count\'] != 0)
{
echo \'<a href=\"../other/profile.php?id=\'.$chat[\'id_user\'].\'\">\'.username($chat[\'id_user\'], 2).\'</a>, \';
echo \'<hr>\';
}
else
{
echo \'В комнате никого нет..<br/><hr>\';
}
}
?>
смысл думаю ясен