-2
I am trying to sort a table that is in Php and that pulls the database data, tried with js called sorttable, but it did not work, the table is with this code:
echo '<table class="sortable">';
echo "<tr><th>Empresa</th><th>Atividade</th><th>Telefone</th><th>Licença</th><th>Contato</th><th>#</th></tr>";
while ($row_empresas = mysqli_fetch_assoc($resultado_empresas)){
echo '<tr>';
echo '<td>' . $row_empresas['nomeCliente'] . '</td>';
echo '<td>' . $row_empresas['documento'] . '</td>';
echo '<td>' . $row_empresas['telefone'] . '</td>';
echo '<td>' . $row_empresas['cidade'] . '</td>';
echo '<td>' . $row_empresas['email'] . '</td>';
echo '<td>';
echo '<a href="'.base_url().'index.php/base2/visualizar/'.$row_empresas['idClientes'].'" style="margin-right: 1%" class="btn tip-top" title="Ver mais detalhes"><i class="icon-eye-open"></i></a>';
echo '<a href="'.base_url().'index.php/base2/editar/'.$row_empresas['idClientes'].'" style="margin-right: 1%" class="btn btn-info tip-top" title="Editar Cliente"><i class="icon-pencil icon-white"></i></a>';
echo '</td>';
echo '</tr>';
}
echo '</table>';
How could I arrange the same so that I could be ordained?
You can’t order the table with
ORDER BY
?– I_like_trains
So, but after she’s got the data inside the table, I wish I could sort through it, not by order by, I don’t know if I was too clear
– Alexandre Yasser Awadallak
It may not be a solution but this can help you. It may not be what you asked for but Datatables can offer you many options.
– I_like_trains