ThroughPHP,IamlistingMYSQLdatabaserecordswithinaWHILELOOP.
Iwouldliketoknowhowtodothissothat,byclickingonID,or,DATA,thedatawillbedisplayedinascendingordescendingorder.
SCRIPTPHP:
<?php$strSQL="SELECT * FROM TABELA ORDER BY id DESC";
$rs = mysqli_query($conecta,$strSQL);
$error = mysqli_error($conecta);
if(!$error){
while($row = mysqli_fetch_array($rs)):
?>
<ul class="lista-posts">
<li class="seleciona"><input type="checkbox" id="checkbox" name="deletar[]" value="<?php echo $row['id']; ?> " /></li>
<li class="id"><?php echo $row['id']; ?></li>
<li class="titulo"><?php echo '<a title="'.$row['titulo'].'" class="link-texto" href="artigo-'.$row['slug'].'">'.substr($row['titulo'], 0, 63).'</a>'; ?></li>
<li class="data"><?php echo '<data class="data">'.date('d/m/Y', strtotime($row['data'])).'</data>'; ?></li>
<li class="data"><?php
if($row['id_categoria'] == 'faq') {
$novoIdCategoria = str_replace("faq","duvidas-frequentes",$row['id_categoria']);
echo '<a href="'.$novoIdCategoria.'.php">'.ucfirst("faq").'</a></data>';
} else {
echo '<a href="'.$row['id_categoria'].'.php">'.ucfirst($row['id_categoria']).'</a></data>';
} ?></li>
<li class="gerenciar"><?php
echo '<a title="Ver" class="apagar" href="artigo-'.$row['slug'].'"><label class="icon-eye"></label></a>';
echo '<a title="Editar" class="editar" href="edita.php?id='.$row['id'].'"><label class=" icon-pencil"></label></a>';?>
</li>
</ul>
<?php endwhile; ?>
Thank you in advance!