Your variables don't seem to have any values assigned to them. Are your field names in mysql called id and product? If so, are they lowercase, or are they ID for example or Product? Cases make a difference.
You could try just echoing $a_row["id"] and $a_row["product"] to see if they even have values assigned to them. Just echo them out right after your while statement. Also, count the number of rows mysql is returning. Maybe it's just returning 0 results.
$result = mysql_query("SELECT * FROM jokes") or die("SELECT Error: ".mysql_error());
$num_rows = mysql_num_rows($result);
echo "Number of Rows equals " . $num_rows . "";
See what that outputs.
You could also clean up your code a little like this
<?php
$db="jokes";
$link = mysql_connect("localhost") or die("Couldn't connect to MySQL");
mysql_select_db($db , $link) or die("Couldn't open $db: ".mysql_error());
$result = mysql_query("SELECT * FROM jokes") or die("SELECT Error: ".mysql_error());
while ($a_row=mysql_fetch_array($result)) {
echo "<a href=details.php?id=" . $a_row["id"] . ">" . $a_row["product"] . "</a><br>\n";
}
?>