-3

When I selected all data from a MySQL table, I want to fetch records in descending in PHP. How can I do it? please help.

Md Monjur Ul Hasan
  • 1,705
  • 1
  • 13
  • 36

2 Answers2

1
SELECT * FROM table ORDER BY column_name DESC;
urfusion
  • 5,528
  • 5
  • 50
  • 87
1

If you want to select data from the database ORDER ID descending. follow this code:

SELECT * FROM Table ORDER BY id DESC

For Example:

<?php 
$sql=mysqli_query($con,"SELECT * FROM Table ORDER BY id DESC");
while($row=mysqli_fetch_array($sql)){
print_r($row);
}
?>