I am working on a project and I get results from a mysql database.
<?php
$servername = "hostname";
$username = "username";
$password = "pw";
$dbname = "app";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT email, title, location, description, date FROM food";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
echo "email: " . $row["email"]. " - title: " . $row["title"]. " - location: " . $row["location"]. "<br>";
echo "" . $row["description"]. " - date: " . $row["date"]. "<br> <br> <br>";
}
} else {
echo "0 results";
}
mysqli_close($conn);
?>
When I do this it works but it sorts the results old – new.
How would I be able to “reverse” this list
I tried to use ORDER BY date_added but it just gave me an error.