Skip to main content
add opcao de sql na resposta
Fonte Link
BillRizer
  • 670
  • 3
  • 18

Caso nao possa mudar na sua query SQL (recomendado)

SELECT * FROM `tabela` ORDER BY `nome` ASC

8.2.1.13 ORDER BY

--

Pode usar o sort() <?php

$fruits = array("lemon", "orange", "banana", "apple");
sort($fruits);
foreach ($fruits as $key => $val) {
    echo "fruits[" . $key . "] = " . $val . "\n";
}

?>

Sera impresso:

fruits[0] = apple
fruits[1] = banana
fruits[2] = lemon
fruits[3] = orange

Caso nao possa mudar na sua query SQL (recomendado)

Pode usar o sort() <?php

$fruits = array("lemon", "orange", "banana", "apple");
sort($fruits);
foreach ($fruits as $key => $val) {
    echo "fruits[" . $key . "] = " . $val . "\n";
}

?>

Sera impresso:

fruits[0] = apple
fruits[1] = banana
fruits[2] = lemon
fruits[3] = orange

Caso nao possa mudar na sua query SQL (recomendado)

SELECT * FROM `tabela` ORDER BY `nome` ASC

8.2.1.13 ORDER BY

--

Pode usar o sort() <?php

$fruits = array("lemon", "orange", "banana", "apple");
sort($fruits);
foreach ($fruits as $key => $val) {
    echo "fruits[" . $key . "] = " . $val . "\n";
}

?>

Sera impresso:

fruits[0] = apple
fruits[1] = banana
fruits[2] = lemon
fruits[3] = orange
Fonte Link
BillRizer
  • 670
  • 3
  • 18

Caso nao possa mudar na sua query SQL (recomendado)

Pode usar o sort() <?php

$fruits = array("lemon", "orange", "banana", "apple");
sort($fruits);
foreach ($fruits as $key => $val) {
    echo "fruits[" . $key . "] = " . $val . "\n";
}

?>

Sera impresso:

fruits[0] = apple
fruits[1] = banana
fruits[2] = lemon
fruits[3] = orange