Listeleme Sorunu
Merhaba arkadaşlar.
Resimdeki gibi bir tablo yapım var.
sections tablosu bölüm isimlerinin tuttulduğu tablo
categories tablosu kategori isimlerinin tuttulduğu tablo
category_sections tablosu ise hangi kategorinin hangi bölüme ait olduğunu tutan tablo
Aşağıdaki şekilde listele yapıyorum ama resimdeki gibi kategoriler çift oluyor. Where de kullandım ama yine aynı.
Bu listeleme işlemini nasıl yapabilirim?
Sorgular
Listeleme
Çıktı
<!-- Sections - Bölümler -->
<?php foreach ($sections as $section) : ?>
<h1><?php echo $section["section_title"]; ?></h1>
<table>
<thead>
<tr>
<th>Kategori Adı</th>
</tr>
</thead>
<tbody>
<!-- Categories - Kategoriler -->
<?php foreach ($section["categories"] as $category_name) : ?>
<tr>
<td><?php echo $category_name; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endforeach; ?>
<!-- Sections - Bölümler Bitiş -->`