Answer the question
In order to leave comments, you need to log in
How to sort the resulting array by field?
Hello!
I ask for help in the following question:
As a result of a query to the MYSQL database, an array of data was obtained, which is safely displayed.
The array has a date field 'date_dec' (date in YYYY-MM-DD format).
But you still need to sort all this by the date field in descending order, and then display it.
Simply sorting by date already in the sql-query itself, I say right away - is not an option. It is necessary to sort the result of the query.
I'm leaning towards the array_multisort() function, but something doesn't work at all, because little experience.
Here is the required part of the code:
/*$_POST['n_dec'];
$_POST['date_dec'];
$_POST['name_dec'];*/
while($row = mysqli_fetch_assoc($query)){
echo $row['n_dec'] ." | ". $row['date_dec'] ." | ". $row['name_dec'];
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question