0
I now have a question, how to put the relationship of employees of a certain function code in ascending alphabetical order.
I’ll put the code down:
<table align="center">
<tr>
<td id="centro">Selecione Gerente</td>
</tr>
<tr>
<td id="centro">
<select name="txtgerente" id="txtgerente" >
<?php
$query_gerente = "SELECT * FROM colaborador WHERE colab_funcao in($cod_ger,$cod_gerjr) ORDER BY CAST(colab_nome_venda AS UNSIGNED) ASC";
$result_gerente = mysqli_query($con, $query_gerente) or die(mysqli_error());
while ($row_gerente = mysqli_fetch_array($result_gerente)) {
echo("<option value='".$row_gerente['colab_id']."'>".$row_gerente['colab_nome_venda']."</option>");
}
?>
</select>
</td>
</tr>
</table>
The colab_funcao field is varchar(3). In it is the code of the official’s function.
What I want is for the list of the names of the employees who have the given function but who are in alphabetical order.
Once again, thank you all for your attention and help.
From what I could understand:
SELECT * FROM colaborador WHERE colab_funcao in($cod_ger,$cod_gerjr) ORDER BY colab_funcao ASC, colab_nome_venda ASC;
.– anonimo
Didn’t work, keeps showing disorderly. Thanks for the help...
– Clériston Melo
What field contains the name of the employee?
– anonimo
colab_nome_venda
– Clériston Melo
I did. A very simple thing and I couldn’t see. It looks like this: $query_manager = "SELECT * FROM collaborator WHERE colab_funcao in($cod_ger,$cod_gerjr) ORDER BY colab_nome_venda ASC";
– Clériston Melo
All right you managed to meet your need, but note that in your question you say: "how to put the employee list of a certain function code in ascending alphabetical order" and not just all employees in ascending alphabetical order.
– anonimo
There were all employees in ascending alphabetical order. I had to first select employees who were from $cod_ger and $cod_gerjr functions. And after this selection, put those selected in ascending alphabetical order.
– Clériston Melo