html lists - How can I reverse the order of data from a mysql query in a PHP while loop? -
$query = mysqli_query($con,'select * test '); while($row = mysqli_fetch_array($query)) { echo ('<li>'.$row['name'].'</li>'); echo '<br>'; }
the result appear like:
apple bananabut want print:
banana apple
try code:
$qry = mysql_query( 'select name test' ); $array = array(); while( $row = mysql_fetch_array( $qry ) ) { $array[] = $row['name']; } krsort( $array ); foreach( $array $new_array ) { echo '<li>'.$new_array.'</li>'; echo '<br>'; }
php html-lists phplist
No comments:
Post a Comment