# Calendar problem

**URL:** <https://forum.kirupa.com/t/calendar-problem/118760>\
**Category:** Uncategorized\
**Created:** [August 9, 2004, 12:34am UTC](https://forum.kirupa.com/t/calendar-problem/118760 "2004-08-09T00:34:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SlowRoasted](https://avatars.discourse-cdn.com/v4/letter/s/a698b9/32.png) [@SlowRoasted](https://forum.kirupa.com/u/SlowRoasted)\
**Post date:** [August 9, 2004, 12:34am UTC](https://forum.kirupa.com/t/calendar-problem/118760/1 "2004-08-09T00:34:56Z")

</div>

ok this is a news calendar. All is going well so far with the code but i want to reverse the order that the records are displayed. So right now the newest items are on bottom and the older items are on top, i want to reverse that. Can someone help plz

```php

<html>
<head>
<title>The Edge Homepage</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 7pt;
	color: #FFFFFF;
}
</style>
</style>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#1F7697" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bottommargin="0">
<table border="0" cellpadding="0" cellspacing="0">

<?php
require_once('mysql_connect.php');
$query = "SELECT date, subject FROM Calendar"; 
$result = mysql_query($query) or die (mysql_error()); 
$num = mysql_num_rows($result);

if($num > 0){
while($row = mysql_fetch_array($result, MYSQL_NUM)){

echo"<tr><td><span class=\"style1\">$row[0]</span></td><td><span class=\"style1\"><a href=calendar2.php target=_parent>$row[1]</a></span></td></tr>";
}
}
else
{
echo'<span class="style1">The calendar is experiencing technical difficulties. We apologize for the inconvenience.</span>'; 
}

echo'</table>'; 
mysql_free_result($result);
mysql_close();
?>
</span>
</table>
</body>
</html>

```

---

<div class="post-metadata">

**Author:** ![Hans\_Kilian](https://avatars.discourse-cdn.com/v4/letter/h/838e76/32.png) [@Hans\_Kilian](https://forum.kirupa.com/u/Hans_Kilian)\
**Post date:** [August 9, 2004, 6:21am UTC](https://forum.kirupa.com/t/calendar-problem/118760/2 "2004-08-09T06:21:55Z")

</div>

Change your SQL from

$query = “SELECT date, subject FROM Calendar”;

to

$query = “SELECT date, subject FROM Calendar ORDER BY date DESC”;

---

<div class="post-metadata">

**Author:** ![SlowRoasted](https://avatars.discourse-cdn.com/v4/letter/s/a698b9/32.png) [@SlowRoasted](https://forum.kirupa.com/u/SlowRoasted)\
**Post date:** [August 9, 2004, 2:16pm UTC](https://forum.kirupa.com/t/calendar-problem/118760/3 "2004-08-09T14:16:19Z")

</div>

thanks man, ill try that;)

edit:

sweet it works thanks:)
