prepare( 'SELECT DISTINCT s.idsections, s.section_name, s.description FROM documents d JOIN sections s ON s.idsections = d.idsections JOIN pages p ON p.idpages = d.page_id WHERE p.slug = ? ORDER BY s.section_name' ); $stmt->execute([$slug]); json_data(array_map('present_section', $stmt->fetchAll()));