How can I make the loop start from latest id to first one?
include 'config.php';
$con->set_charset('utf8');
$sql = "SELECT * FROM tablename";
$names = mysqli_query($con,$sql);
while($row = mysqli_fetch_array ($names)){
//here will make loop start from first id
}
Change your sql variable like this. This should work
$sql = "SELECT * FROM tablename ORDER BY `id` DESC";