I have this table:
I do this query to get sorted data and create a select
:
select id, nombre from usuarios_grupos ORDER BY 'nombre' ASC
... and this is the result, surprisingly does not order it .
Before it worked What have I changed?
Well, I went from a dedicated Windows server to another with Linux and Apache .
I add 12/1/17:
The funny thing is that it does apply a type of order, that is, this query:
select id, name from group_ users ORDER BY ASC name
Return:
Id Name Ascendant 1
10 Payment module
4 Supervisor
9 Store
2 Administrator
1 Creator
8 Partner
3 User
And this query:
select id, name from group_ users ORDER BY name DESC
Return:
id name Descending 1
3 User
8 Partner
1 Creator
2 Administrator
9 Store
4 Supervisor
10 Payment module
This is the php code that is executed, with the same result:
<select name="id_grupo" size="1" <?=$noacceso?>>
<?php
$sql = "select id, nombre from usuarios_grupos";
if((int)$_SESSION["grupo"] !== 1) $sql .= " where id<>1" ;
$sql .= " order by nombre";
$result = $conn->query($sql) Or Die ("ER0081: Error cargando datos");
while($rs = $result->fetch_object())
{
If ((int)$rs->id !== $id_grupo)
{
Echo "<option value='" . $rs->id . "'>" . $rs->nombre . "</option>";
}
Else
{
Echo "<option selected value='" . $rs->id . "'>" . $rs->nombre . "</option>";
}
}
$result->close();
?>