In my website, All I pretty much do is show the fullnames of the users that submitted a form from the database and when a admin clicks a name, it just gives the clicked users email. My question is, how can I arrange the list of names to where it gives me the newest names on top and older on bottom? I have a timestamp cell in there that documents the timestamp when the user submits a form. Here is my code
<?php
require_once('db_login.php');
$stmt = $handler->prepare("SELECT * FROM formdata");
$stmt->execute();
while($result = $stmt->fetch()){
$userid = $result['user_id'];
echo "<a href='speaker_apps.php?infoid={$userid}'>". $result['fullname']."</a></br>";
}
if(isset($_GET['infoid'])){
$stmt = $handler->prepare("SELECT * FROM formdata where user_id='".$_GET['infoid']."'");
$stmt->execute();
$row = $stmt->fetch();
echo "<p>id =".$row['email']."</p></br>";
}
?>