Ok. Este es el codigo donde muestro las categorias y los consecuentes links a mostrar.
Código PHP:
else{
// if there are links, let's display them!
// first step is to set up the header for each category
$query = "SELECT DISTINCT category FROM links ORDER BY category";
$result = mysql_query($query);
printf("<div align='center'><table width='600' border='0' cellspacing='10' cellpadding='0'");
echo "<tr><td><div align='center'>";
// then, lets get a new query and results set so we can display the links from each category
if (isset($c)){
$i=0;
while ( $row = mysql_fetch_array($result))
{
$category = $row["category"];
$category_links="$category"."_links";
$category_head="$category"."_head";
/* echo "<table width='400' border=1' align='center'>
<tr>
<td><div align='center'><a href=\"?c=$category\">$category</a> </div></td>
</tr>
</table>";*/
echo "<a href=\"?c=".$category."\">".$category."</a> ";
if(!($i++%4))
echo "</div></td></tr><tr><td><div align='center'>";
}
echo "</div></td></tr></table></div>";
//echo "<br>";
echo "<b><font color='ffffff'>Category: ".$c."</b>";
$query2 = "SELECT * FROM links WHERE category='$c' ORDER BY name";
$result2 = mysql_query($query2);
while ( $row = mysql_fetch_array($result2))
{
$rec_id = $row["rec_id"];
$name = $row["name"];
$url = $row["url"];
$description = $row["description"];
$count = $row["count"];
$id=$rec_id;
// put the HTTP prefix before each link in case the user forgets to enter it
// first, take it away if it already exists
$url = ereg_replace("http://","",$url);
$reciprocal = ereg_replace("http://","",$reciprocal);
// then add it to all
$url = "http://".$url;
$reciprocal = "http://".$reciprocal;
$category_results="$category"."_results";
// now print the links in this category
echo "<p>";
print("
<tr>
<td>
<div style=\"padding-left:0px; margin-bottom: 10px;\">
<div>
<strong><a href='$url'>$name</a></strong><br>$description <br><b>Url: </b><font color= 'cccccc'>$url</font><br></div>
<td>
</tr></div>");
}
}