<?php $this->amok->sql->query('SELECT id, author, topic, text, datum, uhrzeit FROM notes WHERE sichtbar=1 ORDER BY id DESC', SQL_ALL, SQL_ASSOC); $data = $this->amok->sql->record; $this->amok->sql->query('SELECT notes.id, tags.name FROM notes LEFT JOIN notes_has_tags ON notes.id = notes_has_tags.note JOIN tags ON notes_has_tags.tag = tags.id ORDER BY tags.name ASC', SQL_ALL, SQL_ASSOC); $tags = $this->amok->sql->record; //den Einträgen die zugeordneten Tags in Form eines Arrays hinzufügen for ($i=0; $i<count($tags); $i++) { for ($j=0; $j<count($data); $j++) { if ($tags[$i]['id'] == $data[$j]['id']) { $data[$j]['tags'][] = $tags[$i]['name']; } } }?>