20                         SELECT          chat_id, room_id 
   21                         FROM            chat_room_messages 
   22                         GROUP BY        chat_id, room_id 
   25                 $chat_room_id_comb = array();
 
   27                 while( 
$row = $ilDB->fetchAssoc(
$res) )
 
   29                         $chat_room_id_comb[] = array( 
$row[
'chat_id'], 
$row[
'room_id'] );
 
   32                 foreach( $chat_room_id_comb as $combination )
 
   34                         $res = $ilDB->queryF(
" 
   36                                 FROM            chat_room_messages 
   40                         array( 
'integer', 
'integer' ),
 
   41                         array( $combination[0], $combination[1] )
 
   44                         $xml = 
new SimpleXMLElement(
'<entries />');
 
   45                         $xml->addAttribute(
'chat_id', $combination[0]);
 
   46                         $xml->addAttribute(
'room_id', $combination[1]);
 
   48                         while( 
$row = $ilDB->fetchAssoc(
$res) )
 
   50                                 $child = $xml->addChild(
'entry', 
$row[
'message']);
 
   51                                 $child->addAttribute(
'timestamp', 
$row[
'commit_timestamp']);