What is the default sorting order in MySQL when using ORDER BY?
By default, the sorting order in MySQL when using ORDER BY is ascending (ASC). This means that the results will be sorted in ascending order based on the specified column. If you want to sort the results in descending order, you can specify the DESC keyword after the column name in the ORDER BY clause.
$query = "SELECT * FROM table_name ORDER BY column_name DESC";
$result = mysqli_query($connection, $query);
if($result) {
while($row = mysqli_fetch_assoc($result)) {
// Process each row here
}
} else {
echo "Error: " . mysqli_error($connection);
}