I have a table '' category '' in the database and it has the column 'id' and 'title', I am retrieving the same in several dropdown menu's, however it loads all categories of the database but I would like to load each category on its respective menu, could anyone help me?
Thanks in advance!
<ul>
<li class="drop-menu">
<span class="menu-item">Teste 1 <i class="fas fa-caret-down"></i></span>
<ul class="submenu">
<?php
foreach($categorias as $categoria){
?>
<li><a href="<?php echo base_url
('categoria/'.$categoria->id.'/'.limpar($categoria->titulo)) ?>"><?php echo $categoria->titulo ?></a></li>
<?php
}
?>
</ul>
</li>
<li class="drop-menu">
<span class="menu-item">Teste 2 <i class="fas fa-caret-down"></i></span>
<ul class="submenu">
<?php
foreach($categorias as $categoria){
?>
<li><a href="<?php echo base_url
('categoria/'.$categoria->id.'/'.limpar($categoria->titulo)) ?>"><?php echo $categoria->titulo ?></a></li>
<?php
}
?>
</ul>
</li>
</ul>