newbie question - retrieve and show mysql results by date

Hi - I'm working my way through the sitepoint book "building websites with PHP and MYSQL" by Kevin Yank.

I'm a little stuck and really really would appreciate help on one aspect of retrieving and presenting data from a mysql table using PHP.

I am sending a query to the database and want the results to be returned and formatted on the page, which is fine, but now I want this to be formatted in date order. The database parameters are simple:


My current code is:


// Request the ID and text of all the jokes
$result = @mysql_query('SELECT id, joketext FROM joke');
if (!$result) {
exit('<p>Error performing query: ' .
mysql_error() . '</p>');

// Display the text of each joke in a paragraph
// with a "Delete this joke" link next to each.
while ($row = mysql_fetch_array($result)) {
$jokeid = $row['id'];
$joketext = $row['joketext'];
echo '<p>' . $joketext .
' <a href="' . $_SERVER['PHP_SELF'] .
'?deletejoke=' . $jokeid . '">' .
'Delete this joke</a></p>';


In the MYSQL table there is a parameter jokedate which is not called in the above PHP code - how would I go about getting the returned results in date order. Would I alter the above $jokeid variable to $jokedate instaed, or do I need to create a seperate piece of code with the PHP usort() function.