i doing a site were people add a comment and it gets put in a database and wen i recall the data i want to sort the data so that the highest id is first and so on down the page i have everything but the sorting part and idk how to do that this is my code so far tho:
<?php
//conects and salects database
mysql_connect ("localhost", "root", "password") or die ('I cannot connect to the database because:' .mysql_error());
mysql_select_db ("hospital");
$pid = $_GET['id'];
$query = "SELECT * FROM comments WHERE pid = $pid";
$result = mysql_query($query) or die("Query failed ($query) - " . mysql_error());
while ($comments = mysql_fetch_array($result)) {
echo "<br /> Date: ".$comments['Date_Time'].
"<br />Comment: ".$comments['Comment'].
"<br />";}
?>