PHP和MySQL - 更改代码ORDER BY

Hi i have got little problem with my MySQL database.
I have got these things in my database : enter image description here

When i have code :

$show_name = "SELECT name FROM serverlist_comments WHERE location = 1";
$result = mysqli_query($conn,$show_name);
$show_carriage = "SELECT carriage FROM serverlist_comments WHERE location = 1 ORDER BY datetime";
$result_carriage = mysqli_query($conn,$show_carriage);
while($row_name = mysqli_fetch_assoc($result)){
while($row_carriage = mysqli_fetch_assoc($result_carriage)){
       print($row_name['name']);
       echo " napísal/a toto : ";
       print($row_carriage['carriage']);
       echo "<br/>";
}
}
?>

i will receive output :
"Kubajsk0 napísal/a toto : ok
Kubajsk0 napísal/a toto : niet
Kubajsk0 napísal/a toto : ale "

I know it is everything ok cause in date/time 18:17:29 (as "ok") is first and date/time 18:17:32 (as "niet") comes after it


BUT i want to have JUST THE OPPOSITE of this output.
I want output to be:
"Kubajsk0 napísal/a toto : ale
Kubajsk0 napísal/a toto : niet
Kubajsk0 napísal/a toto : ok"

Thank you for every answer :D

You should add direction to your query: SELECT carriage FROM serverlist_comments WHERE location = 1 ORDER BY datetime DESC

DESC means descending, ASC means ascending.

maybe descending order like:

ORDER BY datetime DESC

or:

ORDER BY datetime ASC

for ascending order

I don't understand why you have two loops. If you want to get the output like:

Kubajsk0 napísal/a toto : ale
Kubajsk0 napísal/a toto : niet
Kubajsk0 napísal/a toto : ok

you can use following code.

$show_carriage = "SELECT name, carriage FROM serverlist_comments WHERE location = 1 ORDER BY datetime DESC";
$result_carriage = mysqli_query($conn,$show_carriage);
while($row_carriage = mysqli_fetch_assoc($result_carriage)){
       echo $row_carriage['name'];
       echo " napísal/a toto : ";
       echo $row_carriage['carriage'];
       echo "<br/>";
}