prepare( "INSERT INTO doc_storage (idhome, entity_type, document_id, title, filename, expirystatus, expirydate, note, created_at, updated_at) VALUES (?, 'home', ?, ?, ?, ?, ?, ?, NOW(), NOW())" ); $stmt->execute([$idhome, $documentId, $title ?: null, $filename, $expiryStatus, $expiry ?: null, $note ?: null]); $id = (int) $pdo->lastInsertId(); $row = $pdo->prepare('SELECT * FROM doc_storage WHERE id = ?'); $row->execute([$id]); json_data(present_file($row->fetch()), 201);