<?php

$ids       = $_POST['ids'];
$projectId = $_POST['projectId'];

$userProject = $db->row("SELECT * FROM project WHERE id = ?", $projectId);

$where = implode(',', $ids);
$logs  = $db->run("SELECT * FROM comment WHERE id IN($where) ORDER BY createdAt DESC");

foreach ( $logs as $key => $log ) {
    $logs[$key]['attachments'] = $db->run("SELECT * FROM attachment WHERE commentId = ?", $log['id']);
    $date               = date('Y-m-d', strtotime($log['createdAt']));
}

include '../template/daily-log.php';