The code While($row=mysql_fetch_assoc($res))returns the rows 1,2,3 ... n-1, n .
While($row=mysql_fetch_assoc($res))
I need after getting from the same $ res (do not make a new request ) strings, but in a different order n, n-1, ..., 2,1 .
Maybe?
You can use the function mysqli_data_seek().
mysqli_data_seek()
Example:
$result = mysqli_query( $query ); $totalRows = mysqli_stmt_num_rows( $result ); for( $i=($totalRows-1); $i>=0; $i-- ) { mysqli_data_seek( $result, $i ); $row = mysqli_fetch_row( $result ); }
Please note: You can mysqli_data_seekonly use after mysqli_query, mysqli_store_resultor mysqli_use_result.
mysqli_data_seek
mysqli_query
mysqli_store_result
mysqli_use_result
A simple inverse juste array and store it in a new variable.
<?php $newvar=array_reverse($array); ?>
ORDER BY columnName , , , ORDER BY columnName DESC
ORDER BY columnName
ORDER BY columnName DESC
Source: https://habr.com/ru/post/1629700/More articles:Pytest boosts test case for .raise_for_status () requests - pythonSkip some row in odd and even colored rows in a table - continuous CSS style - htmlThree JS pieces not displaying - materialMapping the type of instance variables for a member function of a template - c ++Angular Virtual replay material (on demand) repeats the first loaded piece of elements twice - javascripthttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1629701/commit-changes-to-sqlite-database-that-can-be-seen-between-qtabs&usg=ALkJrhjpxfkW0JDN6g02O2jUeqo2zMMQywDjango admin list_filter not showing - pythonHow to use the "Use" statement on ASP.net firewall web pages? - c #How to get Heroku to detect GO buildpack - gitHow to make FullScreen Activity on Android - androidAll Articles