1
I have a list of teachers on a website, and it’s being printed in chronological order, and I wanted to put it alphabetically.
Follows code:
<div class="row">
<ul class="team-list sort-destination appear-animation animated fadeInUp appear-animation-visible" data-appear-animation="fadeInUp" data-appear-animation-delay="50" data-sort-id="team">
<? while ($p = $prof->fetch(PDO::FETCH_ASSOC)){?>
<li class="col-md-3 col-sm-6 col-xs-12 isotope-item <?=str_replace(' ', '-', tirarAcentos($p['materia']));?>">
<div class="team-item thumbnail">
<p class="thumb-info team">
<img class="img-responsive" alt="" src="http://editoraopirus.com.br/uploads/<?=$p['unidade'];?>/professores/<?=$p['url_foto'];?>">
<span class="thumb-info-title">
<span class="thumb-info-inner"><?=$p['nome'];?></span>
<span class="thumb-info-type"><?=$p['materia'];?></span>
</span>
</p>
</div>
</li>
<? }?>
</ul>
</div>
Can’t you change the database query to sort alphabetically? The database is much faster in that sort than PHP or Javascript
– Sergio
You have to touch the Query that brings these teachers. Just give a
ORDER BY nome ASC
– Leandro Lima
Thank you, I’ll test!!
– Cirillo Wallison