config.php

<?php
//session_start();    <---- Handig voor als je sessions gebruikt, staat het altijd boven aan je pagina! :)
//Bij dit script is het niet nodig.
 
$host = "localhost";
$username = "USERNAME";
$password = "PASSWORD";
$db = "DATABASE";
@mysql_connect($host,$username,$password) or die ("error");
@mysql_select_db($db) or die("error");
?>


downloads_cats.php

<?
require("config.php");

$sql = "SELECT DISTINCT(`category`) FROM `downloads`";
$res = mysql_query($sql);


if (mysql_num_rows($res) >= 1)
	{
	while ($row = mysql_fetch_array($res))
	{
$category=$row['category'];
echo "<a href='downloads_overview.php?category=$category'>$category</a><br>";
	}	
	

}
			
		
		else
		{
			echo "There are no downloads yet.";
			}
			?>

downloads_overview.php

<?
require("config.php");

$category = $_GET['category'];

$sql = "SELECT * FROM downloads WHERE category = '$category'";
$res = mysql_query($sql); 

while ($overview = mysql_fetch_array($res))
{

echo "<a href='download.php?id=$overview[id]'>$overview[downloadname]</a>by $overview[postedby] at $overview[postedat]<br>";
}
?>

download.php

[code]
<?
require("config.php");



$id = $_GET['id'];

$sql = "SELECT downloadname,description,postedby,DATE_FORMAT(postedat, '%d/%m/%Y %T') AS postedat ,link,category FROM downloads WHERE id = $id";
$res = mysql_query($sql); 

while ($download = mysql_fetch_array($res))
{
?>

<table width="300" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><div align="center">
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><div align="center"><strong><?=$download['downloadname']; ?></strong></div></td>
        </tr>
      </table>
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="34%">By:</td>
          <td width="66%"><div align="right"><?=$download['postedby']; ?></div></td>
        </tr>
      </table>
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td>At:</td>
          <td><div align="right"><?=$download['postedat']; ?></div></td>
        </tr>
      </table>
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td>Category:</td>
          <td><div align="right"><?=$download['category']; ?></div></td>
        </tr>
      </table>
            <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><div align="center">Description:</div></td>
        </tr>
        <tr>
          <td><?=nl2br($download['description']); ?></td>
        </tr>
      </table>
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><div align="center">Links:</div></td>
        </tr>
        <tr>
          <td><?=nl2br($download['link']); ?></td>
        </tr>
      </table>
        </div></td>
  </tr>
</table>

<?
}
?>
[/code]