<?php
include 'db.php';
$result = mysql_query("SELECT heading FROM site order by site_id DESC");
$num_rows = mysql_num_rows($result);
while ( $a_row = mysql_fetch_object($result) ) {
foreach ($a_row as $field)
printf ("<a href=\"index.php?heading=$field\" id=\"$field\">$field</a><br />");
}
?>